:root {
  --primary: #1a73e8;
  --primary-dark: #0d47a1;
  --primary-light: #e8f0fe;
  --success: #2e7d32;
  --warning: #ed6c02;
  --danger: #c62828;
  --text: #1f2937;
  --text-muted: #6b7280;
  --bg: #f4f6f8;
  --card: #ffffff;
  --border: #e5e7eb;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --radius: 14px;
  --radius-lg: 22px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 18px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.kiosk-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.kiosk-header {
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent;
}

.kiosk-header .logo {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lang-switch {
  display: flex;
  gap: 0.4rem;
}

.lang-switch button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: pointer;
}

.lang-switch button.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.kiosk-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.welcome {
  text-align: center;
  max-width: 640px;
  width: 100%;
}

.welcome h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
  color: var(--primary-dark);
}

.welcome p {
  font-size: 1.25rem;
  color: var(--text-muted);
  margin: 0 0 2.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 1.6rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 600;
  font-family: inherit;
  min-height: 56px;
  transition: transform 0.08s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 14px rgba(26, 115, 232, 0.35);
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-large {
  font-size: 1.4rem;
  padding: 1.4rem 2.4rem;
  min-height: 72px;
  border-radius: var(--radius-lg);
}

.btn-block { width: 100%; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow);
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.step-header {
  margin-bottom: 1.5rem;
}

.step-topnav {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.step-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text);
  padding: 0.55rem 1rem;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.step-back:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
  text-decoration: none;
}

.step-back::before {
  content: "←";
  font-size: 1.1rem;
}

.step-topnav .step-progress {
  flex: 1;
  margin-bottom: 0;
}

.selected-chip {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.5rem 1rem;
  background: var(--primary-light);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  padding: 0.9rem 1.2rem;
  margin-bottom: 1.5rem;
}

.selected-chip-label {
  grid-column: 1;
  grid-row: 1;
  font-size: 0.85rem;
  color: var(--primary-dark);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.selected-chip-value {
  grid-column: 1;
  grid-row: 2;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.selected-chip-edit {
  grid-column: 2;
  grid-row: 1 / span 2;
  font-size: 0.9rem;
  color: var(--primary-dark);
  text-decoration: underline;
  padding: 0.4rem 0.6rem;
}

.step-progress {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.step-progress .dot {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
}

.step-progress .dot.active { background: var(--primary); }
.step-progress .dot.done { background: var(--success); }

.step-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: var(--text);
}

.step-subtitle {
  color: var(--text-muted);
  margin: 0 0 1.5rem;
}

.search-field {
  position: relative;
}

.search-input {
  width: 100%;
  padding: 1rem 1.2rem;
  font-size: 1.2rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: white;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(26, 115, 232, 0.15);
}

.search-results {
  margin-top: 0.75rem;
  max-height: 360px;
  overflow-y: auto;
  border-radius: var(--radius);
  background: white;
  border: 1px solid var(--border);
}

.search-result {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--primary-light); }

.search-result .main {
  font-weight: 600;
  font-size: 1.05rem;
}

.search-result .meta {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.search-result .tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.search-result .tag.supplier {
  background: #fff3e0;
  color: #e65100;
}

.empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
}

/* "Står ikke på listen" — synlig fallback når søgningen ikke finder svaret */
.not-listed {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.not-listed-hint {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.not-listed-btn {
  border: 2px dashed var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
  padding: 0.85rem 1.4rem;
}

.not-listed-btn:hover {
  background: white;
  border-style: solid;
}

.purpose-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.purpose-btn {
  background: white;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
  color: var(--text);
}

.purpose-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.purpose-btn.selected {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.step-actions {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
}

.step-actions .btn { flex: 1; }

.photo-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.photo-stage video,
.photo-stage img,
.photo-stage canvas {
  width: 100%;
  max-width: 480px;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: var(--radius);
  object-fit: cover;
}

.policy-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1rem;
}

.policy-modal {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 700px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.policy-modal header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 1.3rem;
  font-weight: 700;
}

.policy-modal .content {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  line-height: 1.6;
}

.policy-modal .content h1,
.policy-modal .content h2,
.policy-modal .content h3 { margin-top: 1.2rem; }

.policy-modal footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.policy-accept {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 1.05rem;
}

.policy-accept input[type="checkbox"] {
  width: 24px;
  height: 24px;
  cursor: pointer;
  accent-color: var(--primary);
}

.receipt {
  text-align: center;
  padding: 3rem 1.5rem;
}

.receipt h1 {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  color: var(--success);
  margin: 0 0 1rem;
}

.receipt p {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin: 0.5rem 0;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--danger);
  color: white;
  padding: 0.9rem 1.4rem;
  border-radius: var(--radius);
  font-weight: 500;
  box-shadow: var(--shadow);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.toast.show { opacity: 1; }
.toast.success { background: var(--success); }
.toast.warn { background: var(--warning); }

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.input-group label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.input-group input,
.input-group select,
.input-group textarea {
  padding: 0.9rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1.05rem;
  font-family: inherit;
  outline: none;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
  border-color: var(--primary);
}

.admin-shell {
  font-size: 16px;
}

.admin-shell .kiosk-main {
  align-items: flex-start;
  padding-top: 2rem;
}

.admin-nav {
  background: var(--primary-dark);
  color: white;
  padding: 1rem 1.5rem;
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.admin-nav a {
  color: white;
  opacity: 0.9;
  font-weight: 500;
}

.admin-nav a:hover { opacity: 1; }
.admin-nav .brand { font-weight: 700; margin-right: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.table th,
.table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  background: #f9fafb;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.table tr:last-child td { border-bottom: none; }

/* Editor-tabel — inputs der ligner søge-inputs men kompakte */
.table-editor th,
.table-editor td {
  padding: 0.65rem 0.75rem;
  vertical-align: middle;
}

.te-input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: white;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.te-input:hover { border-color: #cbd5e1; }
.te-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}

.te-input--mono {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: #f9fafb;
}

.te-input--num { text-align: center; }

.te-check {
  width: 22px;
  height: 22px;
  cursor: pointer;
  accent-color: var(--primary);
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  min-height: auto;
  font-size: 0.9rem;
  border-radius: 8px;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.badge.active { background: #d1fae5; color: #065f46; }
.badge.checked-out { background: #e5e7eb; color: #374151; }
.badge.failed { background: #fee2e2; color: #991b1b; }
.badge.pending { background: #fef3c7; color: #92400e; }

@media (max-width: 600px) {
  body { font-size: 16px; }
  .card { padding: 1.25rem; border-radius: var(--radius); }
  .btn-large { font-size: 1.2rem; padding: 1.1rem 1.6rem; }
}
