/* ============================================
   BELLALAGER v29 – BDO APT-inspireret design
   Pixel-perfekt match med APT-systemets udtryk
   ============================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Lyst indhold – identisk med APT */
  --bg:       #f4f5f7;
  --bg2:      #ffffff;
  --bg3:      #f8f9fa;
  --bg4:      #eef0f4;
  --border:   #e8eaed;
  --border2:  #d2d5dc;
  --text:     #1c2033;
  --text2:    #52576e;
  --text3:    #9296a8;

  /* Sidebar – præcis APT-farve: blåsort navy */
  --sb-bg:       #1b1f35;
  --sb-bg-hover: #252a42;
  --sb-bg-active:#2d3352;
  --sb-border:   #2e3450;
  --sb-text:     #c4c8d8;
  --sb-text2:    #6b7190;
  --sb-label:    #4a5070;

  /* APT accent: klar blå */
  --accent:      #3b82f6;
  --accent-h:    #2563eb;
  --accent-dim:  rgba(59,130,246,.1);
  --accent-glow: rgba(59,130,246,.2);

  --green:       #16a34a;
  --green-dim:   rgba(22,163,74,.1);
  --red:         #dc2626;
  --red-dim:     rgba(220,38,38,.1);
  --orange:      #ea580c;
  --orange-dim:  rgba(234,88,12,.1);
  --yellow:      #ca8a04;
  --cyan:        #0891b2;
  --purple:      #7c3aed;

  /* Layout – APT bruger 200px sidebar */
  --sidebar-w:      200px;
  --sidebar-w-md:   52px;
  --topbar-h:       48px;
  --radius:         6px;
  --radius-lg:      8px;
  --radius-xl:      10px;
  --content-pad:    24px;
  --content-pad-md: 16px;
  --content-pad-sm: 12px;

  --shadow-xs: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm: 0 2px 6px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.05);
  --shadow:    0 4px 16px rgba(0,0,0,.1);
  --shadow-lg: 0 10px 32px rgba(0,0,0,.14);

  --font-base: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Mono', monospace;
  --ease:      cubic-bezier(.4,0,.2,1);
  --dur-fast:  100ms;
  --dur:       150ms;
}

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-base);
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration:.01ms!important; animation-duration:.01ms!important; }
}

/* ══════════════════════════════════════════
   SIDEBAR – præcis APT-stil
══════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sb-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 200;
  scrollbar-width: thin;
  scrollbar-color: var(--sb-border) transparent;
  transition: transform .22s var(--ease), width .18s var(--ease);
  /* Ingen højre-border som APT – skyggeskillelse */
  border-right: none;
  box-shadow: 2px 0 8px rgba(0,0,0,.18);
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--sb-border); border-radius: 3px; }

/* Kollapset sidebar – manuel skjul/vis, samme ikon-kun-stil som APT */
body.sidebar-collapsed .sidebar { width: var(--sidebar-w-md); }
body.sidebar-collapsed .main-content { margin-left: var(--sidebar-w-md); }
body.sidebar-collapsed .topbar { left: var(--sidebar-w-md); }
body.sidebar-collapsed .sidebar-logo { padding: 12px; justify-content: center; }
body.sidebar-collapsed .logo-text,
body.sidebar-collapsed .nav-text,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .badge-alert,
body.sidebar-collapsed .badge-admin { display: none; }
body.sidebar-collapsed .nav-link { padding: 9px; justify-content: center; margin: 1px 4px; }
body.sidebar-collapsed .nav-link .nav-icon { width: 28px; height: 28px; font-size: 15px; }
body.sidebar-collapsed .sidebar-toggle svg { transform: rotate(180deg); }

/* Logo – APT har ikon + navn på samme linje */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--sb-border);
  flex-shrink: 0;
  margin-bottom: 4px;
}
.logo-icon {
  width: 28px; height: 28px;
  background: var(--accent);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(59,130,246,.4);
}
.logo-text {
  font-weight: 700;
  font-size: 14.5px;
  color: #ffffff;
  white-space: nowrap;
  letter-spacing: -.3px;
}

/* Sektion-labels – APT: small caps, meget diskret */
.nav-section { padding: 0; }
.nav-label {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--sb-label);
  padding: 14px 14px 5px;
  display: block;
  user-select: none;
}

/* Sammenklappelige sektioner – kun på mobil, da menuen ellers bliver for
   lang til at finde rundt i ved at scrolle alene */
@media (max-width: 767px) {
  .nav-label {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: var(--radius);
    margin: 2px 4px;
  }
  .nav-label:active { background: rgba(255,255,255,.06); }
  .nav-label::after {
    content: '';
    width: 7px; height: 7px;
    border-right: 2px solid var(--sb-label);
    border-bottom: 2px solid var(--sb-label);
    transform: rotate(45deg);
    transition: transform .15s var(--ease);
    flex-shrink: 0;
  }
  .nav-section.collapsed .nav-label::after { transform: rotate(-45deg); }
  .nav-section.collapsed .nav-link { display: none; }
}

/* Nav-links – APT: mere luft, rounded hover */
.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px 7px 14px;
  margin: 1px 8px;
  color: var(--sb-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius);
  border: none;
  transition: background var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
}
/* Ikon-wrapper – APT har farverige ikon-bokse */
.nav-link .nav-icon {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 5px;
  font-size: 13px;
  flex-shrink: 0;
  transition: background var(--dur-fast) var(--ease);
}
.nav-link:hover {
  background: var(--sb-bg-hover);
  color: #ffffff;
}
.nav-link:hover .nav-icon { background: rgba(255,255,255,.08); }
.nav-link.active {
  background: var(--sb-bg-active);
  color: #ffffff;
  font-weight: 600;
}
.nav-link.active .nav-icon { background: rgba(59,130,246,.25); }

/* Aktiv indikator – lille blå prik */
.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 16px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

/* Badge */
.badge-alert {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 6px;
  min-width: 17px;
  text-align: center;
  flex-shrink: 0;
}

/* Sidebar footer */
.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--sb-border);
  padding: 10px 12px;
  flex-shrink: 0;
}
.user-info { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.user-avatar {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px; color: #fff; flex-shrink: 0;
}
.user-name { font-weight: 600; font-size: 12px; color: #e8ecf4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 10px; color: var(--sb-text2); }
.btn-logout {
  display: block; width: 100%;
  text-align: center; padding: 6px;
  border: 1px solid var(--sb-border);
  border-radius: var(--radius);
  color: var(--sb-text); text-decoration: none;
  font-size: 11.5px; font-weight: 500;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.btn-logout:hover { background: var(--sb-bg-hover); color: #fff; }

/* ══════════════════════════════════════════
   TOPBAR – APT: hvid, meget ren, tynde borders
══════════════════════════════════════════ */
.topbar {
  position: fixed;
  top: 0; left: var(--sidebar-w); right: 0;
  height: var(--topbar-h);
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 10px;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

/* Breadcrumb – APT stil: "BellaLager / Search" */
.topbar-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text3);
}
.topbar-title a { color: inherit; text-decoration: none; }
.topbar-title a:hover { color: var(--accent); }
.topbar-title .sep { color: var(--border2); }
.topbar-title .current { color: var(--text); font-weight: 600; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* Notifikations-knap – APT stil */
/* Global søgeknap i topbar */
.topbar-search-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; margin-left: 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg3); color: var(--text3);
  cursor: pointer; font-size: 12.5px; font-family: inherit;
  max-width: 220px; flex: 1;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.topbar-search-btn:hover { background: var(--bg4); border-color: var(--border2); }
.topbar-search-label { flex: 1; text-align: left; }
.topbar-search-kbd {
  font-size: 10px; font-weight: 600; padding: 1px 5px; border-radius: 4px;
  background: var(--bg2); border: 1px solid var(--border); color: var(--text3);
  font-family: 'JetBrains Mono', monospace;
}
@media (max-width: 640px) {
  .topbar-search-label, .topbar-search-kbd { display: none; }
  .topbar-search-btn { max-width: 38px; padding: 8px; justify-content: center; margin-left: 8px; }
}

/* Global søgning – overlay + resultater */
.gs-overlay {
  display: none; position: fixed; inset: 0; z-index: 600;
  background: rgba(0,0,0,.5); backdrop-filter: blur(2px);
  align-items: flex-start; justify-content: center;
  padding: 12vh 16px 16px;
}
.gs-overlay.open { display: flex; }
.gs-box {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-xl); width: 100%; max-width: 560px;
  box-shadow: var(--shadow-lg); overflow: hidden;
  display: flex; flex-direction: column; max-height: 70vh;
}
.gs-input-row {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.gs-input-row input {
  flex: 1; border: none; background: transparent; font-size: 15px;
  color: var(--text); font-family: inherit; outline: none;
}
.gs-close {
  border: none; background: var(--bg3); color: var(--text3);
  width: 26px; height: 26px; border-radius: 50%; cursor: pointer; font-size: 13px;
  flex-shrink: 0;
}
.gs-results { overflow-y: auto; padding: 6px; }
.gs-hint { padding: 24px; text-align: center; color: var(--text3); font-size: 13px; }
.gs-group-label {
  font-size: 10.5px; font-weight: 700; color: var(--text3); text-transform: uppercase;
  letter-spacing: .4px; padding: 8px 10px 4px;
}
.gs-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: var(--radius); text-decoration: none; color: var(--text);
  cursor: pointer;
}
.gs-item:hover, .gs-item.active { background: var(--bg3); }
.gs-item-icon { font-size: 17px; flex-shrink: 0; width: 22px; text-align: center; }
.gs-item-title { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-item-sub { font-size: 11.5px; color: var(--text3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-item-text { flex: 1; min-width: 0; }

@keyframes gs-spin { to { transform: rotate(360deg); } }

.topbar-icon-btn {
  position: relative;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  font-size: 16px;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.topbar-icon-btn:hover { background: var(--bg3); border-color: var(--border2); }

/* Sidebar collapse-toggle – desktop, i topbar */
.sidebar-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.sidebar-toggle:hover { background: var(--bg3); border-color: var(--border2); }
.sidebar-toggle svg { transition: transform .18s var(--ease); }


/* Bruger-chip – APT stil: initial + navn */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text2);
  background: transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}
.topbar-user:hover { background: var(--bg3); }
.topbar-user-avatar {
  width: 26px; height: 26px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff;
}

/* Hamburger (mobil) */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 190;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.open { display: block; }

/* ══════════════════════════════════════════
   MOBIL FAB + BOTTOM NAV
══════════════════════════════════════════ */
.scan-fab {
  display: none;
  position: fixed; bottom: 68px; right: 14px;
  background: var(--accent); color: #fff;
  border-radius: 50%; width: 48px; height: 48px;
  font-size: 20px; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: var(--shadow); z-index: 150;
  text-decoration: none; touch-action: manipulation;
  transition: transform var(--dur-fast) var(--ease);
}
.scan-fab:active { transform: scale(.93); }

.mobile-actions {
  display: none; position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #ffffff; border-top: 1px solid var(--border);
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  z-index: 150; gap: 2px;
}
.mob-btn {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 3px; padding: 6px 2px;
  border-radius: var(--radius); text-decoration: none;
  font-size: 10px; font-weight: 600; color: var(--text3);
  background: transparent; border: none; cursor: pointer;
  transition: color var(--dur-fast); touch-action: manipulation;
  min-width: 0;
}
.mob-btn span.ico { font-size: 19px; line-height: 1; }
.mob-btn.active { color: var(--accent); }
.mob-btn.primary { background: var(--accent); color: #fff; border-radius: 8px; }

/* ══════════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════════ */
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  flex: 1;
  padding: var(--content-pad);
  min-width: 0;
}

/* ══════════════════════════════════════════
   PAGE HEADER – APT: titel med ikon
══════════════════════════════════════════ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}
.page-title { font-size: 17px; font-weight: 700; color: var(--text); letter-spacing: -.3px; }
.page-subtitle { font-size: 12px; color: var(--text3); margin-top: 1px; }
.page-header > div:last-child { display: flex; gap: 6px; flex-wrap: wrap; flex-shrink: 0; }

/* ══════════════════════════════════════════
   CARDS – rent hvide med subtil skygge
══════════════════════════════════════════ */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-xs);
}
.card-title {
  font-size: 11px; font-weight: 700; color: var(--text3);
  text-transform: uppercase; letter-spacing: .7px;
  margin-bottom: 12px;
}

/* ══════════════════════════════════════════
   STAT GRID
══════════════════════════════════════════ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.stat-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.stat-card:hover { box-shadow: var(--shadow-sm); border-color: var(--border2); }
.stat-icon  { font-size: 18px; }
.stat-value { font-size: 22px; font-weight: 700; font-family: var(--font-mono); color: var(--text); line-height: 1.15; }
.stat-label { font-size: 11.5px; color: var(--text2); }
.stat-card.warn { border-left: 3px solid var(--orange); }
.stat-card.warn .stat-value { color: var(--orange); }
.stat-card.danger { border-left: 3px solid var(--red); }
.stat-card.danger .stat-value { color: var(--red); }

/* ══════════════════════════════════════════
   TABELLER – APT: kompakt, hvid, tydelig
══════════════════════════════════════════ */
.table-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg2);
  box-shadow: var(--shadow-xs);
}
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px; color: var(--text3);
  padding: 9px 14px; border-bottom: 1px solid var(--border);
  white-space: nowrap; background: var(--bg3);
  position: sticky; top: 0; z-index: 1;
}
td {
  padding: 9px 14px; border-bottom: 1px solid var(--border);
  font-size: 13px; vertical-align: middle; color: var(--text);
}
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f5f7ff; }
.card .table-wrap { border: none; border-radius: 0; margin: -16px; margin-top: 8px; box-shadow: none; }

/* ══════════════════════════════════════════
   BADGES
══════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 7px; border-radius: 4px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-in     { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.badge-out    { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.badge-adj    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.badge-move   { background: #cffafe; color: #0e7490; border: 1px solid #a5f3fc; }
.badge-admin  { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; font-size:11px;padding:2px 7px;border-radius:4px;font-weight:600; }
.badge-lager  { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; font-size:11px;padding:2px 7px;border-radius:4px;font-weight:600; }
.badge-recall { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.badge-expiry { background: #fef9c3; color: #854d0e; border: 1px solid #fde68a; }
.status-aktiv    { background:#dcfce7; color:#15803d; border:1px solid #bbf7d0; border-radius:4px;padding:2px 8px;font-size:11px;font-weight:600; }
.status-udlånt   { background:#fef9c3; color:#854d0e; border:1px solid #fde68a; border-radius:4px;padding:2px 8px;font-size:11px;font-weight:600; }
.status-service  { background:#dbeafe; color:#1e40af; border:1px solid #bfdbfe; border-radius:4px;padding:2px 8px;font-size:11px;font-weight:600; }
.status-kasseret { background:#fee2e2; color:#991b1b; border:1px solid #fecaca; border-radius:4px;padding:2px 8px;font-size:11px;font-weight:600; }
.status-tabt     { background:#f3f4f6; color:#6b7280; border:1px solid #e5e7eb; border-radius:4px;padding:2px 8px;font-size:11px;font-weight:600; }

/* ══════════════════════════════════════════
   KNAPPER – APT: flad, klar blå primær
══════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 7px 14px; border-radius: var(--radius);
  font-size: 13px; font-weight: 600; font-family: inherit;
  border: 1px solid transparent; cursor: pointer;
  text-decoration: none; white-space: nowrap;
  touch-action: manipulation; user-select: none;
  transition: background var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease),
              transform 80ms var(--ease);
}
.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: 0 1px 3px rgba(59,130,246,.35);
}
.btn-primary:hover { background: var(--accent-h); border-color: var(--accent-h); box-shadow: 0 2px 6px rgba(59,130,246,.45); }

.btn-ghost {
  background: var(--bg2); color: var(--text2); border-color: var(--border2);
}
.btn-ghost:hover { background: var(--bg3); color: var(--text); }

.btn-danger { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.btn-danger:hover { background: #fecaca; }
.btn-green  { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.btn-green:hover  { background: #bbf7d0; }
.btn-sm { padding: 4px 9px; font-size: 11.5px; }

/* ══════════════════════════════════════════
   FORMULARER
══════════════════════════════════════════ */
.form-group  { margin-bottom: 14px; }
.form-row    { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3  { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
label        { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 4px; }

input[type=text], input[type=email], input[type=password],
input[type=number], input[type=date], input[type=datetime-local],
input[type=url], input[type=tel], input[type=search],
select, textarea {
  width: 100%; background: var(--bg2);
  border: 1px solid var(--border2); border-radius: var(--radius);
  color: var(--text); padding: 7px 10px; font-size: 13px;
  font-family: inherit; outline: none; -webkit-appearance: none;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
input::placeholder, textarea::placeholder { color: var(--text3); }
textarea { resize: vertical; min-height: 70px; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239296a8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; cursor: pointer;
}
select option { background: var(--bg2); }
.form-hint { font-size: 11px; color: var(--text3); margin-top: 3px; }
.required::after { content: ' *'; color: var(--red); }
input[type=checkbox], input[type=radio] { width: 14px; height: 14px; accent-color: var(--accent); cursor: pointer; }

/* ══════════════════════════════════════════
   ALERTS
══════════════════════════════════════════ */
.alert {
  padding: 10px 14px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; margin-bottom: 14px;
  display: flex; align-items: flex-start; gap: 8px;
  border-left: 3px solid;
}
.alert-success { background:#f0fdf4; border-color:#16a34a; color:#15803d; }
.alert-error   { background:#fef2f2; border-color:#dc2626; color:#991b1b; }
.alert-warn    { background:#fffbeb; border-color:#ea580c; color:#92400e; }
.alert-info    { background:#eff6ff; border-color:#3b82f6; color:#1e40af; }

/* ══════════════════════════════════════════
   FILTRE
══════════════════════════════════════════ */
.filters {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 14px; padding: 10px 12px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-xs);
}
.filters input, .filters select {
  width: auto; flex: 0 1 160px; padding: 5px 8px;
  font-size: 12.5px; height: 32px; background: var(--bg3);
}
.filters select { flex: 0 1 140px; }
.filters .btn   { height: 32px; padding: 0 12px; font-size: 12.5px; }

/* ══════════════════════════════════════════
   TABS
══════════════════════════════════════════ */
.tabs {
  display: flex; border-bottom: 1px solid var(--border);
  margin-bottom: 16px; overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  padding: 8px 16px; font-size: 13px; font-weight: 500;
  color: var(--text2); background: transparent;
  border: none; border-bottom: 2px solid transparent;
  cursor: pointer; font-family: inherit; margin-bottom: -1px;
  text-decoration: none; display: inline-flex; align-items: center;
  gap: 5px; white-space: nowrap;
  transition: color var(--dur-fast) var(--ease);
}
.tab-btn:hover  { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ══════════════════════════════════════════
   PAGINERING
══════════════════════════════════════════ */
.pagination { display: flex; gap: 3px; justify-content: flex-end; flex-wrap: wrap; margin-top: 12px; }
.pagination a, .pagination span {
  padding: 5px 10px; border-radius: var(--radius); font-size: 12.5px; font-weight: 500;
  text-decoration: none; color: var(--text2); border: 1px solid var(--border); background: var(--bg2);
  transition: background var(--dur-fast), color var(--dur-fast);
}
.pagination a:hover { background: var(--bg3); color: var(--text); }
.pagination .current { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ══════════════════════════════════════════
   MODALS
══════════════════════════════════════════ */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 400;
  align-items: center; justify-content: center; padding: 16px;
  backdrop-filter: blur(3px);
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 20px; width: 100%;
  max-width: 480px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; }

/* ══════════════════════════════════════════
   PROGRESS
══════════════════════════════════════════ */
.progress-wrap { display: flex; align-items: center; gap: 6px; }
.progress-bar  { flex: 1; height: 5px; background: var(--bg4); border-radius: 99px; overflow: hidden; min-width: 40px; }
.progress-fill { height: 100%; border-radius: 99px; transition: width .3s; }
.fill-ok   { background: var(--green); }
.fill-warn { background: var(--orange); }
.fill-low  { background: var(--red); }
.qty-low  { color: var(--red);    font-weight: 700; }
.qty-warn { color: var(--orange); font-weight: 600; }
.qty-ok   { color: var(--green);  font-weight: 600; }

/* ══════════════════════════════════════════
   GRIDS
══════════════════════════════════════════ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* ══════════════════════════════════════════
   LOGIN – centreret, ren
══════════════════════════════════════════ */
.login-page {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; background: var(--bg); padding: 16px;
}
.login-box {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 32px 28px; width: 100%;
  max-width: 380px; box-shadow: var(--shadow);
}
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo .logo-icon { font-size: 30px; display: block; margin-bottom: 8px; }
.login-logo .logo-text { font-size: 17px; font-weight: 700; color: var(--text); }

/* ══════════════════════════════════════════
   DIVERSE
══════════════════════════════════════════ */
.cat-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.low-stock-strip {
  background: #fffbeb; border: 1px solid rgba(234,88,12,.2);
  border-left: 3px solid var(--orange); border-radius: var(--radius);
  padding: 9px 12px; font-size: 12.5px; color: var(--orange);
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.recall-banner {
  background: #fef2f2; border: 1px solid rgba(220,38,38,.2);
  border-left: 3px solid var(--red); border-radius: var(--radius);
  padding: 10px 14px; display: flex; align-items: center; gap: 8px;
  color: var(--red); font-weight: 600; margin-bottom: 14px;
}
.lot-tag {
  display: inline-block; background: #eff6ff; color: #1e40af;
  border: 1px solid #bfdbfe; border-radius: 3px;
  font-family: var(--font-mono); font-size: 11px; padding: 1px 5px;
}
.bin-tag {
  display: inline-block; background: #ecfeff; color: #0e7490;
  border: 1px solid #a5f3fc; border-radius: 3px;
  font-family: var(--font-mono); font-size: 11px; padding: 1px 5px;
}
.expiry-expired { color: var(--red);    font-weight: 700; }
.expiry-warn    { color: var(--orange); font-weight: 600; }
.expiry-ok      { color: var(--green); }
.expiry-list-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid var(--border); gap: 10px;
}
.expiry-list-item:last-child { border-bottom: none; }
.expiry-list-item:hover { background: var(--bg3); }
.debit   { color: var(--red);   font-weight: 700; }
.credit  { color: var(--green); font-weight: 700; }
.balance-col { font-family: var(--font-mono); font-weight: 600; }
.text-mono { font-family: var(--font-mono); }
.fefo-badge {
  display: inline-flex; align-items: center; gap: 3px;
  background: #dcfce7; border: 1px solid #bbf7d0;
  color: var(--green); border-radius: 10px;
  font-size: 10px; font-weight: 700; padding: 1px 7px;
}
.bin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.bin-card {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px; cursor: pointer;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.bin-card:hover  { border-color: var(--accent); background: #eff6ff; }
.bin-card.selected { border-color: var(--accent); background: #eff6ff; }
.bin-card .bin-code  { font-family: var(--font-mono); font-size: 12px; font-weight: 700; }
.bin-card .bin-type  { font-size: 10px; color: var(--text3); margin-top: 1px; }
.bin-card .bin-count { font-size: 10.5px; color: var(--text2); margin-top: 5px; }
.form-submit-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* Upload */
.upload-item {
  display:flex; align-items:center; gap:8px; padding:8px 10px;
  background:var(--bg3); border:1px solid var(--border); border-radius:var(--radius); font-size:12.5px;
}
.upload-item .progress-track { flex:1; height:3px; background:var(--bg4); border-radius:99px; overflow:hidden; }
.upload-item .progress-fill-anim { height:100%; background:var(--accent); border-radius:99px; transition:width .3s; width:0%; }
.existing-photo-item:hover .photo-overlay { display:flex!important; }
.dz-active { border-color:var(--accent)!important; background:#eff6ff!important; }

/* Scan */
.scan-container { display:flex; flex-direction:column; align-items:center; gap:14px; }
.scan-viewport { position:relative; width:100%; max-width:300px; border-radius:var(--radius-lg); overflow:hidden; background:#000; aspect-ratio:1; }
.scan-crosshair { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; pointer-events:none; }
.crosshair-box { width:160px; height:160px; border:2px solid rgba(59,130,246,.9); border-radius:10px; box-shadow:0 0 0 9999px rgba(0,0,0,.4); position:relative; }
.result-card { background:var(--bg2); border:1px solid var(--border); border-radius:var(--radius-lg); box-shadow:var(--shadow-xs); }
.result-header { display:flex; align-items:center; gap:12px; padding:14px; border-bottom:1px solid var(--border); }
.result-img { width:56px; height:56px; object-fit:cover; border-radius:var(--radius); flex-shrink:0; }
.result-img-placeholder { width:56px; height:56px; border-radius:var(--radius); flex-shrink:0; background:var(--bg3); display:flex; align-items:center; justify-content:center; font-size:24px; }
.result-body { padding:14px; }
.result-tabs { display:flex; border-bottom:1px solid var(--border); }
.result-tab { flex:1; padding:8px; text-align:center; font-size:12.5px; font-weight:600; color:var(--text2); background:transparent; border:none; cursor:pointer; border-bottom:2px solid transparent; font-family:inherit; transition:color var(--dur-fast); }
.result-tab.active { color:var(--accent); border-bottom-color:var(--accent); }
.tab-panel { display:none; }
.tab-panel.active { display:block; }
.status-found-local { border-color:rgba(22,163,74,.3)!important; }
.status-found-ext   { border-color:rgba(59,130,246,.3)!important; }
.status-not-found   { border-color:rgba(234,88,12,.3)!important; }

/* Quick service */
.svc-card { background:var(--bg2); border:1px solid var(--border); border-radius:var(--radius-lg); padding:14px; }
.svc-interval { display:flex; align-items:center; gap:10px; padding:10px; background:var(--bg3); border:1px solid var(--border); border-radius:var(--radius); cursor:pointer; margin-bottom:6px; transition:border-color var(--dur-fast); }
.svc-interval:hover { border-color:var(--accent); }
.svc-interval.overdue  { border-color:rgba(220,38,38,.4); background:#fef2f2; }
.svc-interval.due-soon { border-color:rgba(234,88,12,.4); background:#fffbeb; }
.interval-icon { font-size:18px; flex-shrink:0; }
.interval-name { font-weight:600; font-size:13px; }
.interval-due  { font-size:11.5px; color:var(--text2); }
.interval-meta { flex:1; min-width:0; }
.consume-row { display:flex; align-items:center; gap:6px; padding:7px 0; border-bottom:1px solid var(--border); }
.consume-row:last-child { border-bottom:none; }
.log-btn { background:#eff6ff; color:var(--accent); border:1px solid #bfdbfe; border-radius:var(--radius); padding:5px 12px; font-weight:600; font-size:12.5px; cursor:pointer; font-family:inherit; }
.log-btn:hover { background:#dbeafe; }

/* Label */
.label-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:10px; }
.label-card { background:var(--bg2); border:1px solid var(--border); border-radius:var(--radius); padding:12px; text-align:center; }
.label-name { font-weight:700; font-size:12.5px; margin-bottom:3px; }
.label-sku  { font-family:var(--font-mono); font-size:10.5px; color:var(--text3); }

/* Reports print */
.stat-row { display:flex; gap:12px; margin-bottom:12px; flex-wrap:wrap; }
.stat-box { border:1px solid var(--border); border-radius:var(--radius); padding:10px 14px; min-width:110px; }
.stat-val { font-size:22px; font-weight:700; color:var(--accent); font-family:var(--font-mono); }
.stat-lbl { font-size:10.5px; color:var(--text2); margin-top:2px; }

/* Utility */
.sub { font-size:11.5px; color:var(--text2); }
.meta { font-size:11.5px; color:var(--text3); }
.note { font-size:12.5px; color:var(--text2); font-style:italic; }
.ok  { color:var(--green); font-weight:600; }
.no-print { }
.close-btn { background:none; border:none; color:var(--text2); cursor:pointer; font-size:18px; padding:0 4px; line-height:1; }
.close-btn:hover { color:var(--text); }
.print-btn { background:#eff6ff; color:var(--accent); border:1px solid #bfdbfe; border-radius:var(--radius); padding:7px 14px; font-size:12.5px; font-weight:600; cursor:pointer; font-family:inherit; }
.item-cb, .lot-cb { cursor:pointer; accent-color:var(--accent); }
.thumb-wrap { position:relative; flex-shrink:0; }
footer { font-size:11px; color:var(--text3); text-align:center; margin-top:20px; }
.hide-mobile { }
.mobile-hide { }
.mobile-only { display:none; }

/* ══════════════════════════════════════════
   TABLET (≤1100px) – sidebar kollapser til ikoner
══════════════════════════════════════════ */
@media (max-width: 1100px) {
  .sidebar { width: var(--sidebar-w-md); }
  .logo-text, .nav-label, .nav-link .nav-text, .user-name, .user-role, .btn-logout { display: none; }
  .sidebar-logo { padding: 12px; justify-content: center; }
  .sidebar-footer { padding: 8px; }
  .user-info { justify-content: center; margin-bottom: 0; }
  .nav-link { padding: 9px; justify-content: center; margin: 1px 4px; }
  .nav-link::before { display: none; }
  .nav-link .nav-icon { width: 28px; height: 28px; font-size: 15px; }
  .main-content { margin-left: var(--sidebar-w-md); }
  .topbar { left: var(--sidebar-w-md); }
}

/* ══════════════════════════════════════════
   MOBIL (≤767px)
══════════════════════════════════════════ */
@media (max-width: 767px) {
  .mobile-actions { display: flex; }
  .scan-fab       { display: flex; }
  .mobile-only    { display: block; }
  .mobile-hide, .hide-mobile { display: none !important; }

  .sidebar {
    width: 236px;
    transform: translateX(-100%);
  }
  /* Genvind skjult tekst på mobil slide-in */
  .logo-text, .nav-link .nav-text, .user-name, .user-role, .btn-logout { display: block; }
  .nav-label { display: block; }
  .sidebar-logo { padding: 14px 16px; justify-content: flex-start; }
  .sidebar-footer { padding: 10px 12px; }
  .user-info { justify-content: flex-start; margin-bottom: 8px; }
  .nav-link { padding: 7px 10px 7px 14px; justify-content: flex-start; margin: 1px 8px; }
  .nav-link::before { display: block; }
  .nav-link .nav-icon { width: 22px; height: 22px; font-size: 13px; }
  .sidebar.open { transform: translateX(0); }

  .main-content {
    margin-left: 0; margin-top: var(--topbar-h);
    padding: var(--content-pad-sm);
    padding-top: calc(var(--topbar-h) + 12px);
    padding-bottom: calc(60px + env(safe-area-inset-bottom));
  }
  .topbar { left: 0; padding: 0 12px; }

  .page-header { flex-direction: column; gap: 8px; }
  .page-header > div:last-child { width: 100%; }
  .page-header .btn { flex: 1; justify-content: center; }
  .page-title { font-size: 15px; }
  .card { padding: 12px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-value { font-size: 19px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .filters { padding: 8px 10px; }

  input[type=text], input[type=email], input[type=password],
  input[type=number], input[type=date], input[type=datetime-local],
  input[type=url], input[type=tel], select, textarea {
    font-size: 16px; min-height: 40px;
  }
  .btn { min-height: 40px; padding: 8px 12px; font-size: 13.5px; }
  .btn-sm { min-height: 34px; padding: 5px 10px; font-size: 12px; }
  .login-box { padding: 24px 18px; }
  .form-submit-row { flex-direction: column; }
  .form-submit-row .btn { width: 100%; }
}

@media (max-width: 400px) {
  .stat-grid { gap: 6px; }
  .stat-value { font-size: 17px; }
  .main-content { padding: 8px; padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
}

@media (min-width: 1400px) {
  :root { --content-pad: 28px; }
  .stat-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .main-content { max-width: 1600px; }
}

/* Print */
@media print {
  .no-print, .sidebar, .hamburger, .mobile-actions, .scan-fab, .topbar { display:none!important; }
  .main-content { margin:0; padding:12px; }
  body { background:#fff; color:#000; font-size:11px; }
  .card { border:1px solid #ccc; box-shadow:none; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }
* { scrollbar-width: thin; scrollbar-color: var(--border2) transparent; }
