/* Norreport Bikes Desk – Dashboard */

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --border: #ececec;
  --text: #111827;
  --muted: #6b7280;

  --sidebar-bg: #0e2524;
  --sidebar-active: #1a4739;
  --sidebar-text: #e8efee;
  --sidebar-muted: #9db3b0;

  --accent: #f26a1b;
  --accent-hover: #dc5a10;
  --link: #2563eb;

  --blue-bg: #e3edff;   --blue: #2563eb;
  --purple-bg: #ede7fe; --purple: #7c3aed;
  --green-bg: #dcf5e4;  --green: #178a43;
  --red-bg: #fde4e4;    --red: #dc2626;

  --radius: 12px;
  --sidebar-w: 255px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
}

button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.icon { width: 22px; height: 22px; flex: none; }

/* ---------- Layout ---------- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.content {
  padding: 0 24px 24px;
  flex: 1;
}

/* ---------- Sidebar ---------- */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 14px 20px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
}

.brand {
  text-align: center;
  margin-bottom: 26px;
}
.brand .icon { width: 56px; height: 40px; }
.brand-name {
  margin-top: 8px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fff;
}
.brand-sub { font-size: 14px; color: var(--sidebar-text); }

.nav { display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 16px;
  color: var(--sidebar-text);
  transition: background 0.15s;
}
.nav-item .icon { width: 26px; height: 26px; }
.nav-item:hover { background: rgba(255, 255, 255, 0.06); }
.nav-item.is-active { background: var(--sidebar-active); color: #fff; }
.nav-item.is-active .icon { color: #4ade80; }

.nav-divider {
  height: 1px;
  margin: 18px 4px;
  background: rgba(255, 255, 255, 0.12);
}

.sidebar-spacer { flex: 1; }

.user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: transparent;
  text-align: left;
}
.user-card .user-meta { flex: 1; min-width: 0; }
.user-card strong { display: block; font-size: 15px; font-weight: 600; }
.user-card small { color: var(--sidebar-muted); font-size: 13px; }

.shop {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 14px 8px;
}
.shop strong { display: block; font-size: 14px; font-weight: 600; }
.shop small { color: var(--sidebar-muted); font-size: 13px; }

.logout {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  margin-top: 6px;
  border: 0;
  background: transparent;
  font-size: 16px;
  color: var(--sidebar-text);
}
.logout:hover { color: #fff; }

.avatar {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #6b7a80;
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  flex: none;
}
.avatar.sm { width: 44px; height: 44px; }

/* ---------- Topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.search {
  flex: 1;
  max-width: 830px;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 48px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafafa;
  color: var(--muted);
}
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  color: var(--text);
}
.search input::placeholder { color: #8b929c; }
.search:focus-within { border-color: var(--accent); background: #fff; }
.kbd {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  color: var(--muted);
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 22px;
}

.bell {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
}
.bell .dot {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid #fff;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 22px;
  border: 0;
  border-left: 1px solid var(--border);
  background: transparent;
  font-size: 16px;
  font-weight: 500;
}

/* ---------- Page header ---------- */

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0 18px;
}
.page-head h1 {
  margin: 0;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.page-head p { margin: 4px 0 0; font-size: 18px; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 65px;
  min-width: 293px;
  padding: 0 28px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 22px;
  font-weight: 600;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--accent-hover); }

/* ---------- Stat cards ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat {
  position: relative;
  display: grid;
  grid-template-columns: 54px 1fr;
  column-gap: 16px;
  padding: 14px 16px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.15s;
}
.stat:hover { border-color: #d6d6d6; }

.stat-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
}
.stat-icon.blue   { background: var(--blue-bg);   color: var(--blue); }
.stat-icon.purple { background: var(--purple-bg); color: var(--purple); }
.stat-icon.green  { background: var(--green-bg);  color: #fff; }
.stat-icon.red    { background: var(--red-bg);    color: #fff; }
.stat-icon.green .check,
.stat-icon.red .check {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
}
.stat-icon.green .check { background: var(--green); }
.stat-icon.red .check   { background: var(--red); }

.stat-title { font-size: 16px; font-weight: 600; }
.stat-value { grid-column: 2; font-size: 34px; font-weight: 700; line-height: 1.15; }
.stat-desc  { grid-column: 2; font-size: 14px; color: var(--muted); }
.stat-chevron {
  position: absolute;
  top: 16px;
  right: 14px;
  color: #6b7280;
}
.stat-head {
  grid-column: 2;
  grid-row: 1;
}
.stat-icon { grid-row: 1 / span 3; }

/* ---------- Panels & table ---------- */

.panel {
  padding: 16px 16px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 18px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}
.panel-head h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.panel-head p { margin: 2px 0 0; font-size: 15px; color: var(--muted); }

.link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--link);
  font-weight: 600;
  font-size: 16px;
  white-space: nowrap;
}
.link:hover { text-decoration: underline; }

.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  min-width: 960px;
  border-collapse: collapse;
  font-size: 15px;
}
.table thead th {
  padding: 12px 6px;
  background: #f5f6f7;
  color: #4b5563;
  font-weight: 500;
  font-size: 14px;
  text-align: left;
  white-space: nowrap;
}
.table thead th:first-child { border-radius: 8px 0 0 8px; padding-left: 6px; }
.table thead th:last-child  { border-radius: 0 8px 8px 0; }

.table tbody td {
  padding: 10px 6px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fcfcfc; }
.table .num { font-weight: 700; }
.table .date { font-size: 14px; color: #374151; line-height: 1.3; }

/* ---------- Status badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
.badge .icon { width: 18px; height: 18px; }
.badge.sms     { background: var(--purple-bg); color: var(--purple); }
.badge.created { background: var(--blue-bg);   color: var(--blue); }
.badge.done    { background: var(--green-bg);  color: var(--green); }
.badge.cancel  { background: var(--red-bg);    color: var(--red); }

/* ---------- Row actions ---------- */

.btn-secondary {
  padding: 9px 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f4f5f6;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.btn-secondary:hover { background: #eceef0; }

.btn-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #111;
}
.btn-icon:hover { background: #f1f2f3; }

/* ---------- Activity box ---------- */

.activity {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 16px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f9f9f9;
}
.activity .info {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--blue-bg);
  color: var(--blue);
  font-weight: 700;
  font-size: 15px;
  flex: none;
}
.activity strong { display: block; font-size: 16px; font-weight: 600; }
.activity p { margin: 4px 0 0; color: #4b5563; }

/* ---------- Footer ---------- */

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 24px;
  color: var(--muted);
  font-size: 14px;
}
.footer .links { display: flex; gap: 18px; }
.footer a:hover { color: var(--text); }

/* =====================================================
   Tilføjelser til dit eksisterende JS (modaler, login)
   ===================================================== */

#app { display: none; }

button.nav-item {
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
button.nav-item.is-active { background: var(--sidebar-active); }
.nav-item:disabled { opacity: 0.55; cursor: default; }

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

/* Knapper og felter i de JS-genererede vinduer (Ny sag, Vis sag, Rediger, Afsluttede) */
.case-overlay button,
.edit-overlay button {
  border: 0;
  border-radius: 8px;
  padding: 11px 16px;
  background: #eceef0;
  font-weight: 600;
}
.case-overlay button:hover,
.edit-overlay button:hover { background: #e1e4e7; }

.case-overlay .new-button,
.edit-overlay .new-button {
  background: var(--accent);
  color: #fff;
}
.case-overlay .new-button:hover,
.edit-overlay .new-button:hover { background: var(--accent-hover); }

.edit-overlay input, .edit-overlay textarea {
  border: 1px solid #d9dce0;
  border-radius: 8px;
  font: inherit;
}
.edit-overlay input:focus, .edit-overlay textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}

.status {
  display: inline-block;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}
.status.new      { background: var(--blue-bg);   color: var(--blue); }
.status.sms-sent { background: var(--purple-bg); color: var(--purple); }
.status.closed   { background: var(--green-bg);  color: var(--green); }

.empty-row td { padding: 28px; text-align: center; color: var(--muted); }

/* ---------- Login (uændret udseende) ---------- */

#loginScreen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    linear-gradient(rgba(0,0,0,0.45), rgba(0,0,0,0.45)),
    url("images/login-bike.jpg") center / cover no-repeat;
}
.login-box {
  width: 350px;
  max-width: 100%;
  background: rgba(255,255,255,0.97);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 18px 45px rgba(0,0,0,0.25);
}
.login-logo { font-size: 22px; font-weight: 800; margin-bottom: 8px; letter-spacing: -0.3px; }
.login-logo span { color: var(--accent); }
.login-subtitle { color: #777; margin-bottom: 25px; font-size: 14px; }
.login-box label { display: block; font-weight: bold; margin-bottom: 7px; }
.login-box input {
  width: 100%;
  padding: 13px;
  margin-bottom: 16px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font: inherit;
  font-size: 16px;
  background: #fff;
}
.login-button {
  width: 100%;
  padding: 13px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.login-button:disabled { opacity: 0.6; cursor: not-allowed; }
#loginError {
  display: none;
  margin-bottom: 16px;
  padding: 12px;
  border-radius: 10px;
  background: #ffe8e8;
  color: #a40000;
}


/* =====================================================
   Responsivt: iPad og mobil
   ===================================================== */

.burger, .backdrop { display: none; }

.burger {
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

/* Lille laptop / iPad liggende */
@media (max-width: 1280px) {
  .btn-primary { min-width: 0; height: 56px; font-size: 18px; padding: 0 24px; }
}

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table { min-width: 0; }
  .table th:nth-child(9), .table td:nth-child(9),
  .table th:nth-child(10), .table td:nth-child(10) { display: none; } /* rækken er klikbar */
}

/* iPad stående og mindre: sidebar bliver til menu */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 280px;
    max-width: 85vw;
    height: 100dvh;
    z-index: 60;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }
  body.nav-open .sidebar { transform: translateX(0); box-shadow: 8px 0 30px rgba(0,0,0,.3); }

  .backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }
  body.nav-open .backdrop { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }

  .burger { display: grid; }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    gap: 12px;
    padding: 10px 16px;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
  }
  .kbd { display: none; }
  .user-menu { padding-left: 0; border-left: 0; }
  .user-menu span:not(.avatar) { display: none; }

  .content { padding: 0 16px 16px; }
  .page-head { padding: 16px 0; }
  .page-head h1 { font-size: 30px; }
  .page-head p { font-size: 16px; }

  .table th:nth-child(8), .table td:nth-child(8) { display: none; }

  .footer { padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px)); }

  /* undgå iOS-zoom ved fokus i felter */
  .search input,
    .edit-overlay input, .edit-overlay textarea { font-size: 16px; }
}

/* Mobil */
@media (max-width: 700px) {
  .page-head { flex-direction: column; align-items: stretch; gap: 14px; }
  .page-head h1 { font-size: 26px; }
  .btn-primary { width: 100%; height: 54px; font-size: 17px; }

  .stats { gap: 10px; }
  .stat { grid-template-columns: 40px 1fr; column-gap: 10px; padding: 12px; }
  .stat-icon { width: 40px; height: 40px; }
  .stat-icon .icon { width: 20px !important; height: 20px !important; }
  .stat-title { font-size: 14px; }
  .stat-value { font-size: 26px; }
  .stat-desc { display: none; }

  .panel { padding: 14px 12px 6px; }
  .panel-head h2 { font-size: 20px; }
  .panel-head p { font-size: 14px; }

  /* tabelrækker bliver til kort */
  .table-wrap { overflow: visible; }
  .table, .table tbody { display: block; }
  .table thead { display: none; }

  .table tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "num    status"
      "name   total"
      "phone  total"
      "bike   bike"
      "repair repair"
      "date   date";
    gap: 2px 12px;
    padding: 14px 12px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
  }
  .table tbody td { display: block; padding: 0; border: 0; }
  .table td:nth-child(1) { grid-area: num; font-size: 17px; }
  .table td:nth-child(2) { grid-area: name; font-weight: 600; margin-top: 6px; }
  .table td:nth-child(3) { grid-area: phone; color: var(--muted); font-size: 14px; }
  .table td:nth-child(4) { grid-area: bike; margin-top: 8px; }
  .table td:nth-child(5) { grid-area: repair; color: #4b5563; font-size: 14px; }
  .table td:nth-child(6) { grid-area: total; align-self: end; text-align: right; font-weight: 700; font-size: 16px; }
  .table td:nth-child(7) { grid-area: status; justify-self: end; }
  .table td:nth-child(8) { grid-area: date; display: block; margin-top: 8px; font-size: 13px; color: var(--muted); }
  .table td:nth-child(8) br { display: none; }
  .table td:nth-child(8)::after { content: ""; }
  .table td:nth-child(9), .table td:nth-child(10) { display: none; }

  .table .empty-row { display: block; padding: 0; border: 0; background: transparent; }
  .table .empty-row td { display: block; padding: 24px 8px; }

  .activity { padding: 14px 12px 16px; }
  .footer { flex-direction: column; gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}


/* =====================================================
   Sider (views), kort og formularer
   ===================================================== */

[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

button.link {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  font-size: 16px;
  color: var(--link);
  cursor: pointer;
}

.crumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.crumb .icon { width: 18px; height: 18px; }
.crumb:hover { text-decoration: underline; }

.view-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: 16px 0 18px;
}
.view-head h1 {
  margin: 0;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.view-head p { margin: 4px 0 0; font-size: 17px; color: #374151; }

.chips { display: flex; gap: 14px; }
.chip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.chip small { display: block; font-size: 13px; color: #4b5563; }
.chip div span { display: block; font-size: 14px; color: var(--muted); max-width: 190px; line-height: 1.3; }
.chip-label { font-size: 15px; color: #4b5563; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
  padding-bottom: 8px;
}
.stack { display: grid; gap: 14px; min-width: 0; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.card {
  min-width: 0;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.card-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 700;
}
.card-title small { font-size: 13px; font-weight: 500; color: var(--muted); }

.ico {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
}
.ico .icon { width: 20px; height: 20px; }
.ico.blue   { background: var(--blue-bg);   color: var(--blue); }
.ico.purple { background: var(--purple-bg); color: var(--purple); }
.ico.gray   { background: #eceef1;          color: #374151; }

/* ---------- Felter ---------- */

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.narrow { max-width: 260px; }
.card label { font-size: 14px; font-weight: 600; }
.req { color: var(--red); }

.card input[type="text"],
.card input[type="number"],
.card textarea {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid #d9dce0;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 15px;
}
.card textarea { height: 96px; padding: 12px 14px; resize: vertical; }
.card input::placeholder, .card textarea::placeholder { color: #9aa1aa; }
.card input:focus, .card textarea:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(242, 106, 27, 0.18);
}

.price-wrap { position: relative; }
.price-wrap input { padding-right: 42px !important; text-align: right; }
.price-wrap span {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 14px;
  pointer-events: none;
}

/* ---------- Reparationslinjer ---------- */

.repair-lines { display: grid; gap: 10px; }
.repair-row {
  display: grid;
  grid-template-columns: 1fr 150px 44px;
  gap: 10px;
  align-items: center;
}
.repair-head {
  display: grid;
  grid-template-columns: 26px 1fr 150px 44px;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px 0;
  border-radius: 8px;
  background: #f5f6f7;
  color: #4b5563;
  font-size: 14px;
}
.repair-head span:first-child { padding-left: 10px; }
.repair-lines.numbered { counter-reset: rl; }
.numbered .repair-row { grid-template-columns: 26px 1fr 150px 44px; }
.numbered .repair-row::before {
  counter-increment: rl;
  content: counter(rl);
  padding-left: 10px;
  color: #4b5563;
  font-size: 14px;
}

.row-remove {
  display: grid;
  place-items: center;
  width: 44px;
  height: 46px;
  border: 0;
  border-radius: 10px;
  background: var(--red-bg);
  color: var(--red);
  cursor: pointer;
}
.row-remove .icon { width: 19px; height: 19px; }
.row-remove:hover { background: #fbd0d0; }

.empty-repairs {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 22px 16px;
  border: 1.5px dashed #cdd1d6;
  border-radius: 10px;
  background: #fafafa;
  font: inherit;
  color: var(--text);
  cursor: pointer;
}
.empty-repairs strong { font-size: 16px; }
.empty-repairs small { font-size: 14px; color: var(--muted); }
.empty-repairs:hover { border-color: var(--accent); background: #fff8f3; }
.plus-dot {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: #4b5563;
  color: #fff;
}
.plus-dot .icon { width: 18px; height: 18px; }

.add-line {
  width: 100%;
  height: 46px;
  margin-top: 12px;
  border: 1.5px dashed #cdd1d6;
  border-radius: 10px;
  background: #fff;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.add-line:hover { border-color: var(--accent); background: #fff8f3; }
.add-line.small {
  width: auto;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border);
  background: #f4f5f6;
  color: var(--text);
}
.add-line.small:hover { background: #eceef0; }

/* ---------- Priser ---------- */

.sum-row, .kv-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 8px 0;
  font-size: 15px;
}
.sum-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  padding: 14px 0 4px;
  border-top: 1px solid var(--border);
  font-size: 18px;
  font-weight: 700;
}
.sum-total strong { font-size: 24px; }
.sum-total.bar {
  padding: 12px 14px;
  border: 0;
  border-radius: 8px;
  background: #f1f2f4;
}
.rabat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }

.note-box {
  display: flex;
  gap: 12px;
  margin: 14px 0;
  padding: 14px;
  border-radius: 10px;
  background: #eaf1ff;
  color: #374151;
  font-size: 14px;
  line-height: 1.45;
}
.note-box p { margin: 0 0 6px; }
.note-box p:last-child { margin-bottom: 0; }
.note-box strong { display: block; margin-bottom: 4px; color: var(--text); }
.info-ico { width: 24px; height: 24px; flex: none; color: var(--blue); }
.note-box .badge { margin-top: 6px; }

/* ---------- Knapper ---------- */

.btn-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 50px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.btn-block .icon { width: 21px; height: 21px; }
.btn-block:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-block.big { height: 56px; font-size: 18px; }
.b-accent  { background: var(--accent); color: #fff; }
.b-accent:hover:not(:disabled)  { background: var(--accent-hover); }
.b-green   { background: #16664a; color: #fff; }
.b-green:hover:not(:disabled)   { background: #11523b; }
.b-sms     { background: #ede7fe; color: #5b21b6; }
.b-sms:hover:not(:disabled)     { background: #e1d8fd; }
.b-cancel  { background: #fde4e4; color: #c81e1e; }
.b-cancel:hover:not(:disabled)  { background: #fbd0d0; }
.b-neutral { background: #eef0f2; color: var(--text); }
.b-neutral:hover:not(:disabled) { background: #e3e6e9; }

.actions { display: grid; gap: 10px; }

/* ---------- Vis sag ---------- */

.kv { display: grid; grid-template-columns: 110px 1fr; gap: 10px 12px; margin: 0; font-size: 15px; }
.kv dt { color: #4b5563; }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.kv-row span:last-child, .kv-row strong { text-align: right; }

.mini-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.mini-table th {
  padding: 10px;
  background: #f5f6f7;
  color: #4b5563;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
}
.mini-table th:first-child { border-radius: 8px 0 0 8px; width: 48px; }
.mini-table th:last-child { border-radius: 0 8px 8px 0; }
.mini-table td { padding: 12px 10px; border-bottom: 1px solid var(--border); }
.mini-table tr:last-child td { border-bottom: 0; }
.mini-table .r, .list-table .r { text-align: right; }
.muted-cell { color: var(--muted); }
.note-text { margin: 0; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.note-text.muted { color: var(--muted); }

/* ---------- Sager / Afsluttede ---------- */

.tabs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 22px;
  border: 0;
  border-radius: 10px;
  background: #eceef1;
  color: #374151;
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
}
.tab .icon { width: 21px; height: 21px; }
.tab.is-active { background: #16664a; color: #fff; font-weight: 600; }
.tab:not(.is-active):hover { background: #e1e4e8; }

.search-card { margin-bottom: 14px; padding: 14px 16px; }
.list-search {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafafa;
  color: var(--muted);
}
.list-search input {
  flex: 1;
  min-width: 0;
  border: 0 !important;
  outline: 0;
  background: transparent !important;
  box-shadow: none !important;
  font: inherit;
  font-size: 15px;
  color: var(--text);
}
.list-search:focus-within { border-color: var(--accent); background: #fff; }

.list-card { padding: 8px 16px 0; margin-bottom: 18px; }
.list-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.list-table thead th {
  padding: 12px 8px;
  background: #f5f6f7;
  color: #4b5563;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}
.list-table thead th:first-child { border-radius: 8px 0 0 8px; }
.list-table thead th:last-child { border-radius: 0 8px 8px 0; }
.list-table tbody td { padding: 12px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.list-table tbody tr:hover { background: #fcfcfc; }
.list-table .num { font-weight: 700; }
.list-table .amt { text-align: right; font-weight: 700; padding-right: 20px; white-space: nowrap; }
.list-table .empty-row td { padding: 28px; text-align: center; color: var(--muted); border-bottom: 0; }
.chev-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 34px;
  border-radius: 8px;
  background: #f1f2f4;
  color: #374151;
}
.chev-btn .icon { width: 17px; height: 17px; }
.list-foot { padding: 18px 8px 20px; color: var(--muted); font-size: 15px; }
.list-foot strong { color: var(--text); }

/* ---------- Pop-ups ---------- */

.popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 11000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(14, 37, 36, 0.55);
  backdrop-filter: blur(2px);
  animation: popFade 0.15s ease-out;
}
.popup {
  width: 420px;
  max-width: 100%;
  padding: 32px 28px 26px;
  border-radius: 16px;
  background: #fff;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  animation: popIn 0.2s ease-out;
}
.popup-icon {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: 0 auto 16px;
  border-radius: 50%;
  color: #fff;
}
.popup-icon.success { background: #1c9b63; box-shadow: 0 0 0 8px #dcf5e4; }
.popup-icon.error   { background: var(--red); box-shadow: 0 0 0 8px var(--red-bg); }
.popup-icon.warning { background: #f59e0b; box-shadow: 0 0 0 8px #fdefd0; }
.popup h3 { margin: 0 0 8px; font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.popup p { margin: 0 0 22px; color: var(--muted); font-size: 16px; line-height: 1.45; }
.popup h3:last-child { margin-bottom: 22px; }
.popup-actions { display: flex; flex-direction: column; gap: 10px; }
.popup-actions.row { flex-direction: row; }
.popup-actions.row .p-btn { flex: 1; }
.p-btn {
  height: 50px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.p-btn.primary { background: #1c7c54; color: #fff; }
.p-btn.primary:hover { background: #16664a; }
.p-btn.danger { background: var(--red); color: #fff; }
.p-btn.danger:hover { background: #b91c1c; }
.p-btn.ghost { background: #eef0f2; color: var(--text); }
.p-btn.ghost:hover { background: #e3e6e9; }

@keyframes popFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(0.97); } to { opacity: 1; transform: none; } }

/* ---------- Responsivt for de nye sider ---------- */

@media (min-width: 1101px) {
  .layout > aside { position: sticky; top: 16px; }
}

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .hide-md { display: none; }

  /* Vis sag: knapperne (SMS / Afslut) øverst, så de er lette at nå efter et QR-scan */
  #view-detail .layout > aside { order: -1; }
  #view-detail .layout > aside > .card:not(:first-child) { display: none; }
}

@media (max-width: 900px) {
  .view-head h1 { font-size: 30px; }
  .view-head p { font-size: 16px; }
  .card input[type="text"], .card input[type="number"], .card textarea,
  .list-search input { font-size: 16px; }

  .list-table th:nth-child(4), .list-table td:nth-child(4) { display: none; }
}

@media (max-width: 700px) {
  .view-head { flex-direction: column; gap: 12px; }
  .view-head h1 { font-size: 26px; }
  .chips { width: 100%; }
  .chip { width: 100%; }

  .pair, .form-grid, .rabat-grid { grid-template-columns: 1fr; }
  .rabat-grid { gap: 14px; }
  .field.narrow { max-width: none; }
  .card { padding: 16px; }

  .repair-row { grid-template-columns: 1fr 104px 42px; gap: 8px; }
  .repair-head { display: none; }
  .numbered .repair-row { grid-template-columns: 22px 1fr 104px 42px; gap: 8px; }
  .numbered .repair-row::before { padding-left: 4px; }
  .row-remove { width: 42px; }

  .tab { flex: 1; justify-content: center; padding: 0 12px; font-size: 15px; }
  .search-card { padding: 10px; }

  .list-card { padding: 10px 10px 0; }
  .list-table, .list-table tbody { display: block; }
  .list-table thead { display: none; }
  .list-table tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "num    status"
      "name   total"
      "phone  total"
      "bike   bike"
      "repair repair";
    gap: 2px 12px;
    padding: 14px 12px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
  }
  .list-table tbody td { display: block; padding: 0; border: 0; }
  .list-table td:nth-child(1) { grid-area: num; font-size: 17px; }
  .list-table td:nth-child(2) { grid-area: name; font-weight: 600; margin-top: 6px; }
  .list-table td:nth-child(3) { grid-area: phone; color: var(--muted); font-size: 14px; }
  .list-table td:nth-child(4) { grid-area: bike; display: block; margin-top: 8px; }
  .list-table td:nth-child(5) { grid-area: repair; color: #4b5563; font-size: 14px; }
  .list-table td:nth-child(6) { grid-area: total; align-self: end; padding: 0; font-size: 16px; }
  .list-table td:nth-child(7) { grid-area: status; justify-self: end; }
  .list-table td:nth-child(8) { display: none; }
  .list-table tbody .empty-row { display: block; padding: 0; border: 0; background: transparent; }
  .list-table tbody .empty-row td { display: block; padding: 24px 8px; }
  .list-foot { padding: 8px 4px 16px; }

  .kv { grid-template-columns: 90px 1fr; }

  .popup-overlay { padding: 16px; }
  .popup { padding: 28px 20px 20px; }
  .popup h3 { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .popup, .popup-overlay { animation: none; }
}

/* Topbar må ikke gøre siden bredere end skærmen på mobil */
.search { min-width: 0; }
.topbar-right { flex: none; }
