/* ═══════════════════════════════════════════════════════════════
   Madspild Dashboard – Design System
   Farvepalette fra appens theme.dart
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Roboto+Mono:wght@400;500&display=swap');

/* ─── CSS Variables (Light Mode) ─────────────────────────────── */
:root {
  --bg-offwhite: #F9F9F7;
  --bg-white: #FFFFFF;
  --primary-brand: #E1EBF4;
  --primary-green: #8DAA91;
  --primary-dark: #1A1C19;
  --accent-orange: #D97757;
  --secondary-green: #8DAA91;
  --secondary-text: #5E625B;
  --secondary-grey: #BCC1B8;
  --price-green: #2D5A27;
  --separator: #F0F2EE;
  --border: #E0E4DE;
  --status-red: #C62828;
  --status-blue-bg: #E1EBF4;
  --status-blue: #1565C0;

  --sidebar-width: 240px;
  --sidebar-collapsed-width: 60px;
  --topbar-height: 64px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.10);
  --transition: 0.18s ease;
}

/* ─── Dark Mode Variables ────────────────────────────────────── */
[data-theme="dark"] {
  --bg-offwhite: #1E201D;
  --bg-white: #252724;
  --primary-brand: #2A3830;
  --primary-dark: #E8EAE6;
  --secondary-text: #9EA39B;
  --secondary-grey: #4A4E47;
  --separator: #2E302C;
  --border: #363A33;
  --status-blue-bg: #1A2535;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .sidebar {
  background: #1A1C19;
  border-right: 1px solid #2E302C;
}

[data-theme="dark"] .topbar {
  background: #252724;
  border-bottom-color: #363A33;
}

[data-theme="dark"] .footer {
  background: #252724;
  border-top-color: #363A33;
}

[data-theme="dark"] thead th {
  background: #1E201D;
}

[data-theme="dark"] tbody tr:hover {
  background: #2E302C;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: #1E201D;
  border-color: #363A33;
  color: var(--primary-dark);
}

[data-theme="dark"] .badge-green {
  background: #1A2E1C;
  color: #81C784;
}

[data-theme="dark"] .badge-red {
  background: #2E1A1A;
  color: #EF9A9A;
}

[data-theme="dark"] .badge-orange {
  background: #2E1F14;
  color: #FFCC80;
}

[data-theme="dark"] .badge-grey {
  background: #2E302C;
  color: #9EA39B;
}

[data-theme="dark"] .config-active {
  background: #1A2E1C !important;
  border-color: #4CAF50 !important;
  color: #81C784 !important;
}

/* ─── Reset & Base ───────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-offwhite);
  color: var(--primary-dark);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: inherit;
}

input,
select,
textarea {
  font-family: inherit;
}

/* ─── Layout ─────────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--topbar-height) 1fr auto;
  grid-template-areas:
    "sidebar topbar"
    "sidebar main"
    "sidebar footer";
  min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  grid-area: sidebar;
  background: var(--primary-brand);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  z-index: 100;
  overflow: visible;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  height: var(--topbar-height);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo .logo-icon {
  font-size: 22px;
  line-height: 1;
}

.sidebar-logo .logo-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-dark);
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.sidebar-logo .logo-sub {
  font-size: 10px;
  color: var(--secondary-text);
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--secondary-text);
  padding: 16px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 500;
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
  position: relative;
}

.nav-item:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--primary-dark);
}

.nav-item.active {
  background: rgba(0, 0, 0, 0.08);
  color: var(--primary-dark);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary-dark);
  border-radius: 0 2px 2px 0;
}

.nav-item .nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-footer form button {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid var(--border);
  color: var(--secondary-text);
  font-size: 13px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  width: 100%;
  transition: all var(--transition);
}

.sidebar-footer form button:hover {
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}

/* ─── Topbar ─────────────────────────────────────────────────── */
.topbar {
  grid-area: topbar;
  margin-left: var(--sidebar-width);
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: var(--topbar-height);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}

.topbar-left h1 {
  font-size: 17px;
  font-weight: 600;
  color: var(--primary-dark);
}

.topbar-left .breadcrumb {
  font-size: 12px;
  color: var(--secondary-text);
  margin-top: 1px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--secondary-text);
  background: var(--bg-offwhite);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 20px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.green {
  background: var(--primary-brand);
}

.status-dot.red {
  background: var(--status-red);
}

.status-dot.orange {
  background: var(--accent-orange);
}

/* ─── Main Content ───────────────────────────────────────────── */
.main-content {
  grid-area: main;
  margin-left: var(--sidebar-width);
  padding: 28px;
  min-height: calc(100vh - var(--topbar-height) - 48px);
}

/* ─── Footer ─────────────────────────────────────────────────── */
.footer {
  grid-area: footer;
  margin-left: var(--sidebar-width);
  background: var(--bg-white);
  border-top: 1px solid var(--border);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--secondary-text);
}

.footer-items {
  display: flex;
  align-items: center;
  gap: 20px;
}

.footer-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ─── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── Stat Cards ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow var(--transition), transform var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--secondary-text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-dark);
  font-family: 'Roboto Mono', monospace;
  line-height: 1;
}

.stat-value.green {
  color: var(--price-green);
}

.stat-value.orange {
  color: var(--accent-orange);
}

.stat-sub {
  font-size: 12px;
  color: var(--secondary-text);
}

.stat-icon {
  font-size: 20px;
  margin-bottom: 4px;
}

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary-brand);
  color: var(--primary-dark);
  border: 1px solid var(--border);
}

.btn-primary:hover {
  background: #cbdceb;
  /* Slightly darker blue hover */
  box-shadow: var(--shadow-md);
}

.btn-danger {
  background: var(--status-red);
  color: #fff;
}

.btn-danger:hover {
  background: #b71c1c;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--secondary-text);
}

.btn-outline:hover {
  border-color: var(--secondary-green);
  color: var(--primary-green);
  background: var(--separator);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

/* ─── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-green {
  background: #E8F5E9;
  color: var(--price-green);
}

.badge-red {
  background: #FFEBEE;
  color: var(--status-red);
}

.badge-orange {
  background: #FFF3E0;
  color: #E65100;
}

.badge-grey {
  background: var(--separator);
  color: var(--secondary-text);
}

.badge-ios {
  background: #f3f3f3;
  color: #333;
}

.badge-android {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge-premium {
  background: #e3f2fd;
  color: #1565c0;
  border: 1px solid #bbdefb;
}

/* ─── Tables ─────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: var(--bg-offwhite);
  color: var(--secondary-text);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

tbody tr {
  border-bottom: 1px solid var(--separator);
  transition: background var(--transition);
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--bg-offwhite);
}

tbody td {
  padding: 12px 16px;
  color: var(--primary-dark);
  vertical-align: middle;
}

.td-mono {
  font-family: 'Roboto Mono', monospace;
  font-size: 12px;
  color: var(--secondary-text);
}

.td-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ─── Forms ──────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--primary-dark);
  margin-bottom: 6px;
}

.form-label .optional {
  font-weight: 400;
  color: var(--secondary-text);
  font-size: 12px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--primary-dark);
  background: var(--bg-white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--secondary-green);
  box-shadow: 0 0 0 3px rgba(141, 170, 145, 0.2);
}

.form-hint {
  font-size: 12px;
  color: var(--secondary-text);
  margin-top: 5px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ─── Flash Messages ─────────────────────────────────────────── */
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 20px;
}

.flash-success {
  background: #E8F5E9;
  color: var(--price-green);
  border: 1px solid #C8E6C9;
}

.flash-error {
  background: #FFEBEE;
  color: var(--status-red);
  border: 1px solid #FFCDD2;
}

/* ─── Empty State ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--secondary-text);
}

.empty-state .empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 13px;
}

/* ─── Activity Log ───────────────────────────────────────────── */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--separator);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--secondary-green);
  margin-top: 5px;
  flex-shrink: 0;
}

.activity-text {
  font-size: 13px;
  color: var(--primary-dark);
}

.activity-time {
  font-size: 11px;
  color: var(--secondary-text);
  margin-top: 2px;
  font-family: 'Roboto Mono', monospace;
}

/* ─── Page Header ────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-dark);
}

.page-header p {
  font-size: 13px;
  color: var(--secondary-text);
  margin-top: 2px;
}

/* ─── Login Page ─────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-offwhite);
}

.login-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  padding: 40px;
  width: 100%;
  max-width: 380px;
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo .logo-emoji {
  font-size: 36px;
}

.login-logo h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-top: 8px;
}

.login-logo p {
  font-size: 13px;
  color: var(--secondary-text);
  margin-top: 4px;
}

.login-error {
  background: #FFEBEE;
  color: var(--status-red);
  border: 1px solid #FFCDD2;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── Responsive ─────────────────────────────────────────────── */
/* ─── Responsive (Merged into UI Polish section) ─────────────── */
@media (max-width: 480px) {
  .main-content {
    padding: 16px;
  }
}


/* Remote Config Styles */
.config-active {
  background: #f0fdf4 !important;
  border-color: #86efac !important;
  color: #166534;
}

/* ═══════════════════════════════════════════════════════════════
   UI POLISH – Gruppe A
   ═══════════════════════════════════════════════════════════════ */

/* ─── Dark Mode Toggle Button ────────────────────────────────── */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-offwhite);
  color: var(--secondary-text);
  font-size: 16px;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.theme-toggle-btn:hover {
  background: var(--separator);
  color: var(--primary-dark);
  box-shadow: var(--shadow-md);
  transform: rotate(15deg);
}

/* ─── Hamburger Button (mobil) ───────────────────────────────── */
.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-offwhite);
  color: var(--secondary-text);
  font-size: 18px;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.hamburger-btn:hover {
  background: var(--separator);
  color: var(--primary-dark);
}

/* ─── Sidebar Overlay (mobil) ───────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* ─── Sidebar Collapse (desktop) ────────────────────────────── */
.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-white);
  color: var(--secondary-text);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
  position: absolute;
  right: -14px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 110;
  box-shadow: var(--shadow-md);
}

.sidebar-collapse-btn:hover {
  background: var(--primary-brand);
  color: var(--primary-dark);
}

.sidebar-logo-wrapper {
  position: relative;
}

/* ─── Collapsed Sidebar State ────────────────────────────────── */
.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .logo-sub,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .sidebar-footer form button span:last-child {
  display: none;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 10px;
  gap: 0;
}

.sidebar.collapsed .nav-item .nav-icon {
  width: auto;
  font-size: 18px;
}

.sidebar.collapsed .sidebar-footer form button {
  justify-content: center;
  padding: 8px;
}

.sidebar.collapsed .sidebar-collapse-btn {
  right: -14px;
  transform: translateY(-50%) rotate(180deg);
}

.sidebar.collapsed+.topbar,
.sidebar.collapsed~.main-content,
.sidebar.collapsed~.footer {
  margin-left: var(--sidebar-collapsed-width);
}

/* Topbar og main-indhold skal reagere på sidebar-bredde */
.layout.sidebar-collapsed .topbar,
.layout.sidebar-collapsed .main-content,
.layout.sidebar-collapsed .footer {
  margin-left: var(--sidebar-collapsed-width);
}

/* ─── Smooth Sidebar Transition ─────────────────────────────── */
.sidebar {
  transition: width 0.25s ease;
}

.topbar,
.main-content,
.footer {
  transition: margin-left 0.25s ease;
}

/* ─── Micro-animations ───────────────────────────────────────── */

/* Fade-in for main content ved sideindlæsning */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.main-content {
  animation: fadeInUp 0.3s ease forwards;
}

/* Pulse animation til status-dots */
@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--secondary-grey);
  flex-shrink: 0;
}

.status-dot.green {
  background: var(--primary-green);
  box-shadow: 0 0 8px rgba(141, 170, 145, 0.5);
  animation: pulse 2.5s ease-in-out infinite;
}

.status-dot.red {
  background: var(--status-red);
  box-shadow: 0 0 8px rgba(198, 40, 40, 0.4);
}

/* Scale-in til stat-cards ved indlæsning */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.97);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.stat-card {
  animation: scaleIn 0.25s ease forwards;
}

/* Staggered animation til stat-cards */
.stats-grid .stat-card:nth-child(1) {
  animation-delay: 0.05s;
}

.stats-grid .stat-card:nth-child(2) {
  animation-delay: 0.10s;
}

.stats-grid .stat-card:nth-child(3) {
  animation-delay: 0.15s;
}

.stats-grid .stat-card:nth-child(4) {
  animation-delay: 0.20s;
}

.stats-grid .stat-card:nth-child(5) {
  animation-delay: 0.25s;
}

.stats-grid .stat-card:nth-child(6) {
  animation-delay: 0.30s;
}

/* Smooth focus ring på input-felter */
.form-control,
select,
textarea {
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

/* Button ripple effect */
.btn {
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.15);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.btn:active::after {
  opacity: 1;
}

/* Nav item hover glide */
.nav-item {
  transition: background 0.15s ease, color 0.15s ease, padding-left 0.15s ease;
}

.nav-item:hover {
  padding-left: 24px;
}

.sidebar.collapsed .nav-item:hover {
  padding-left: 10px;
}

/* Flash-besked slide-in animation */
@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.alert,
.flash {
  animation: slideInDown 0.25s ease forwards;
}

/* Tooltip til collapsed sidebar nav-items */
.sidebar.collapsed .nav-item {
  position: relative;
}

.sidebar.collapsed .nav-item::after {
  content: attr(data-label);
  position: absolute;
  left: calc(var(--sidebar-collapsed-width) - 4px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--primary-dark);
  color: var(--bg-white);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 200;
  box-shadow: var(--shadow-md);
}

.sidebar.collapsed .nav-item:hover::after {
  opacity: 1;
}

/* ─── Responsivt Layout (Gruppe A & Rettelse af Audit-fejl) ────── */
@media (max-width: 900px) {
  .hamburger-btn {
    display: flex;
  }

  .sidebar-collapse-btn {
    display: none;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease, width 0.25s ease;
    z-index: 1000; /* Højere z-index for at dække alt på mobil */
    display: flex !important; /* Sikrer at den aldrig er display:none */
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "topbar"
      "main"
      "footer";
  }

  .topbar,
  .main-content,
  .footer {
    margin-left: 0 !important;
    transition: none;
  }

  /* Fejl #2: Topbar optimering */
  .topbar {
    padding: 0 16px;
  }
  .topbar-left h1 {
    font-size: 15px;
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar-right {
    gap: 6px;
  }
  .topbar-btn {
    width: 32px;
    height: 32px;
    margin-left: 4px;
    font-size: 14px;
  }

  /* Fejl #4: Page Header knæk */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  /* Fejl #6: Notifikationer der klipper */
  .notification-dropdown {
    width: auto;
    left: 16px;
    right: 16px;
    max-width: none;
    top: 64px;
  }
}

@media (max-width: 480px) {
  .main-content {
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .topbar-left h1 {
    max-width: 120px;
  }

  .login-card {
    padding: 24px;
  }
}

@media (max-width: 380px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .topbar-left h1 {
    display: none; /* Skjul titel på meget små skærme for at give plads til ikoner */
  }
}

/* ═══════════════════════════════════════════════════════════════
   UI POLISH – Gruppe C: Productivity tools
   ═══════════════════════════════════════════════════════════════ */

/* ─── Topbar Buttons ───────────────────────────────────────── */
.topbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-offwhite);
  color: var(--secondary-text);
  font-size: 16px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  margin-left: 8px;
}

.topbar-btn:hover {
  background: var(--separator);
  color: var(--primary-dark);
}

.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #F44336;
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 10px;
  border: 2px solid var(--bg-white);
  line-height: 1;
}

/* ─── Modal Overlay (Search) ────────────────────────────────── */
.search-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: flex-start;
  justify-content: center;
  padding-top: 100px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.search-modal-overlay.active {
  display: flex;
  opacity: 1;
}

.search-modal-container {
  width: 90%;
  max-width: 600px;
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border);
  overflow: hidden;
  transform: translateY(-20px);
  transition: transform 0.2s ease;
}

.search-modal-overlay.active .search-modal-container {
  transform: translateY(0);
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.search-icon {
  font-size: 18px;
  margin-right: 12px;
  color: var(--secondary-text);
}

#globalSearchInput {
  background: transparent;
  border: none;
  flex: 1;
  font-size: 16px;
  color: var(--primary-dark);
  outline: none;
}

.search-shortcut {
  font-size: 10px;
  background: var(--bg-offwhite);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--secondary-text);
}

.search-results {
  max-height: 400px;
  overflow-y: auto;
}

.search-empty {
  padding: 30px;
  text-align: center;
  color: var(--secondary-text);
  font-size: 14px;
}

.search-result-group-label {
  padding: 10px 20px;
  background: var(--bg-offwhite);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--secondary-text);
  letter-spacing: 0.5px;
}

.search-result-item {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background 0.1s ease;
  text-decoration: none;
  border-bottom: 1px solid var(--separator);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: var(--bg-offwhite);
}

.search-result-icon {
  font-size: 18px;
}

.search-result-content {
  flex: 1;
}

.search-result-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-dark);
}

.search-result-sub {
  font-size: 12px;
  color: var(--secondary-text);
}

/* ─── Notification Dropdown ────────────────────────────── */
.notification-dropdown {
  display: none;
  position: fixed;
  top: 60px;
  right: 20px;
  width: 320px;
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  z-index: 1000;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.2s ease;
}

.notification-dropdown.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.notification-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.notification-header span {
  font-weight: 700;
  font-size: 13px;
}

.notification-header button {
  background: transparent;
  border: none;
  color: var(--primary-brand);
  font-size: 11px;
  cursor: pointer;
}

.notification-list {
  max-height: 350px;
  overflow-y: auto;
}

.notification-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 12px;
  cursor: pointer;
  transition: background 0.1s ease;
}

.notification-item:last-child {
  border-bottom: none;
}

.notification-item:hover {
  background: var(--bg-offwhite);
}

.notification-item.unread {
  background: var(--bg-offwhite);
}

.notification-item.unread::after {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--primary-brand);
  border-radius: 50%;
  margin-top: 6px;
}

.notification-item-icon {
  font-size: 18px;
}

.notification-item-content {
  flex: 1;
}

.notification-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 2px;
}

.notification-item-desc {
  font-size: 12px;
  color: var(--secondary-text);
  line-height: 1.4;
}

.notification-item-time {
  font-size: 10px;
  color: var(--secondary-text);
  margin-top: 4px;
}

.notification-empty {
  padding: 30px;
  text-align: center;
  color: var(--secondary-text);
  font-size: 13px;
}

/* ─── Quick Copy UI ───────────────────────────────────────── */
.copyable {
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
}

.copyable:hover {
  color: var(--primary-green);
}

.copy-badge {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary-dark);
  color: white;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 1000;
  white-space: nowrap;
}

.copy-badge.visible {
  opacity: 1;
}

/* ─── Dashboard Grid (Advanced Layout) ─────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  align-items: start;
}

/* Responsive Grid */
@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .card-wide, .card-full {
    grid-column: span 1 !important;
  }
}

/* Widget Spans */
.stat-card {
  grid-column: span 1;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 15px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

.card-wide {
  grid-column: span 2;
  min-height: 300px;
}

.card-full {
  grid-column: span 4;
  min-height: 200px;
}


@media (max-width: 1200px) {

  .card-wide,
  .card-full {
    grid-column: span 2;
  }
}

@media (max-width: 600px) {

  .stat-card,
  .card-wide,
  .card-full {
    grid-column: span 1;
  }
}

/* Internal Card Styles (Flattened) */
.card-grid-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-offwhite);
  border-radius: var(--radius-sm);
}

.status-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-text strong {
  display: block;
  font-size: 13px;
}

.status-text span {
  display: block;
  font-size: 11px;
  color: var(--secondary-text);
}

.job-list-dashboard,
.activity-list-mini {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.job-item-mini,
.activity-item-mini {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background: var(--bg-offwhite);
  border-radius: var(--radius-sm);
}

.activity-item-mini {
  align-items: flex-start;
  gap: 10px;
}

.activity-content {
  flex: 1;
}

.activity-main {
  font-size: 13px;
  font-weight: 500;
}

.activity-desc {
  font-size: 11px;
  color: var(--secondary-text);
}

.activity-date {
  font-size: 10px;
  color: var(--secondary-grey);
  margin-top: 2px;
}

.view-all-link {
  display: block;
  text-align: center;
  margin-top: 15px;
  font-size: 12px;
  color: var(--primary-green);
  text-decoration: none;
  font-weight: 700;
}

.system-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
}

.sys-stat-box {
  background: var(--bg-offwhite);
  padding: 15px;
  border-radius: var(--radius-sm);
}

.sys-label {
  font-size: 11px;
  color: var(--secondary-text);
  margin-bottom: 5px;
}

.sys-val {
  font-size: 16px;
  font-weight: 700;
}

.sys-sub {
  font-size: 12px;
  color: var(--secondary-grey);
  border-top: 1px solid var(--border);
  padding-top: 5px;
  margin-top: 5px;
}

.sys-progress {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin-top: 8px;
  overflow: hidden;
}

.sys-progress-fill {
  height: 100%;
}

.shortcut-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ─── Dashboard Customization ─────────────────────────────── */
.widget-hidden {
  display: none !important;
}

.edit-mode .stat-card,
.edit-mode .card {
  position: relative;
  outline: 2px dashed var(--accent-orange);
  outline-offset: 4px;
  opacity: 0.8;
  cursor: grab !important;
  user-select: none;
}

.edit-mode .stat-card:active,
.edit-mode .card:active {
  cursor: grabbing !important;
}

.widget-dragging {
  opacity: 0.4;
  transform: scale(0.98);
  border: 2px solid var(--accent-orange);
}

.widget-drop-target {
  outline: 2px solid var(--primary-green) !important;
  background: rgba(141, 170, 145, 0.05) !important;
}

.widget-hide-btn {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 24px;
  height: 24px;
  background: var(--accent-orange);
  color: white;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.widget-hide-btn:hover {
  background: var(--status-red);
  transform: scale(1.1);
}

.edit-mode .stat-card:hover,
.edit-mode .card:hover {
  opacity: 1;
}

#editDashboardBtn.active {
  background: var(--accent-orange);
  color: white;
  border-color: var(--accent-orange);
}