/* Paletten er den samme som homelab-dashboardet paa 8030. */
:root {
  --canvas: #f5f4f0;
  --surface: #fffefb;
  --ink: #2a2a28;
  --ink-soft: #6b6a64;
  --ink-faint: #9a988f;
  --moss: #4a5a4e;
  --sage: #9caf97;
  --warn: #c08a3e;
  --alert: #a94f4f;
  --line: #e2e0d8;
  --line-strong: #d0cdc2;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(42, 42, 40, 0.05);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px 64px; }

/* ------------------------------------------------------------- topbjaelke */

header.top {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  margin-bottom: 28px;
}
header.top .wrap {
  padding-block: 16px;
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}
.brand {
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 9px;
}
.brand:hover { text-decoration: none; }
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--sage);
  box-shadow: 0 0 0 3px rgba(156, 175, 151, 0.22);
}
nav.main { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
nav.main a {
  padding: 6px 13px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
}
nav.main a:hover { background: var(--canvas); text-decoration: none; }
nav.main a.active { background: var(--moss); color: #fff; }

/* ----------------------------------------------------------------- typo */

h1 {
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 4px;
}
h2 { font-size: 17px; font-weight: 600; margin: 0 0 14px; }
.sub { color: var(--ink-soft); font-size: 14px; margin: 0 0 24px; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 12px;
}

/* ----------------------------------------------------------------- kort */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }

.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 18px;
  min-width: 132px;
}
.stat .label {
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 600;
}
.stat .value { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }

/* -------------------------------------------------------------- knapper */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 15px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--canvas); text-decoration: none; }
.btn-primary { background: var(--moss); border-color: var(--moss); color: #fff; }
.btn-primary:hover { background: #3d4b40; }
.btn-danger { color: var(--alert); border-color: #e6cfcf; }
.btn-danger:hover { background: #faf0f0; }
.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn-icon {
  width: 30px; height: 30px; padding: 0;
  font-size: 16px; line-height: 1; font-weight: 500;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Billedvalg: store trykflader, saa de er til at ramme paa mobil. */
.pick { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-pick { padding: 12px 20px; font-size: 15px; flex: 0 1 auto; }
@media (max-width: 620px) {
  .pick { flex-direction: column; }
  .btn-pick { width: 100%; padding: 15px 20px; font-size: 16px; }
}

/* ------------------------------------------------------------ formularer */

label.field { display: block; margin-bottom: 16px; }
label.field > span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 5px;
}
input[type="text"], input[type="number"], input[type="url"], input[type="search"],
select, textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(156, 175, 151, 0.22);
}
textarea { resize: vertical; min-height: 74px; }
input[type="file"] { font: inherit; font-size: 14px; max-width: 100%; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 18px; }
.form-actions {
  display: flex; gap: 10px; align-items: center;
  padding-top: 18px; margin-top: 4px;
  border-top: 1px solid var(--line);
}

/* --------------------------------------------------------------- tabeller */

table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fbfaf6; }
.table-scroll { overflow-x: auto; }

.thumb {
  width: 42px; height: 42px;
  object-fit: cover;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--canvas);
  display: block;
}
.thumb-empty {
  width: 42px; height: 42px;
  border-radius: 7px;
  border: 1px dashed var(--line-strong);
  background: var(--canvas);
}
.cell-name { font-weight: 600; }
.cell-meta { font-size: 13px; color: var(--ink-soft); }
.mono { font-family: var(--mono); font-size: 13px; }

.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(156, 175, 151, 0.2);
  color: var(--moss);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.pill-muted { background: var(--canvas); color: var(--ink-soft); border: 1px solid var(--line); }

/* --------------------------------------------------------- antal-styring */

.qty {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.qty .num {
  min-width: 52px;
  text-align: center;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.qty .unit { color: var(--ink-faint); font-size: 12px; }

/* Detaljesidens variant. Tallet staar for sig selv, saa de fire knapper har
   plads i den smalle kolonne uanset om der staar 0 eller 1200. */
.qty-lg { display: flex; flex-direction: column; gap: 12px; }
.qty-value {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
}
.qty-value .num {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.qty-value .unit { color: var(--ink-faint); font-size: 13px; }

.qty-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
/* Bredden foelger teksten i stedet for at vaere laast som .btn-icon. */
.btn-step {
  padding: 8px 0;
  min-width: 0;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.qty-set { display: flex; gap: 6px; }
.qty-set input { min-width: 0; flex: 1 1 auto; }
.qty-set .btn { flex: 0 0 auto; }

/* ------------------------------------------------------------ analysepanel */

.analysis {
  border: 1px solid var(--sage);
  border-radius: var(--radius);
  background: rgba(156, 175, 151, 0.08);
  padding: 18px;
  margin-top: 16px;
}
.analysis-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.analysis-head strong { font-size: 15px; }
.reasoning {
  font-size: 13px; color: var(--ink-soft);
  font-style: italic; margin: 0 0 14px;
}
.suggestions { display: flex; flex-direction: column; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.suggestion {
  display: grid;
  grid-template-columns: 148px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 9px 12px;
  background: var(--surface);
}
.suggestion .key {
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-soft);
}
.suggestion .val { word-break: break-word; font-size: 14px; }
.suggestion.used { background: rgba(156, 175, 151, 0.14); }

.conf {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; color: var(--ink-soft);
}
.conf-bar { width: 64px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.conf-bar span { display: block; height: 100%; background: var(--sage); }
.conf-low .conf-bar span { background: var(--warn); }

.notice {
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
  margin-top: 16px;
}
.notice-error { background: #faf0f0; border: 1px solid #e6cfcf; color: var(--alert); }
.notice-warn { background: #fbf4e8; border: 1px solid #ecdcc0; color: #8a6220; }
.notice-info { background: var(--surface); border: 1px solid var(--line); color: var(--ink-soft); }

.spinner-msg { display: none; align-items: center; gap: 9px; color: var(--ink-soft); font-size: 14px; margin-top: 12px; }
.htmx-request .spinner-msg { display: flex; }
.spinner {
  width: 15px; height: 15px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--moss);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------- detaljeside */

.detail { display: grid; grid-template-columns: 280px 1fr; gap: 24px; align-items: start; }
.detail img.photo {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  display: block;
}
.spec-list { display: grid; grid-template-columns: 160px 1fr; gap: 0; }
.spec-list dt {
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-soft);
  padding: 9px 0; border-bottom: 1px solid var(--line);
}
.spec-list dd {
  margin: 0; padding: 9px 0; border-bottom: 1px solid var(--line);
  word-break: break-word;
}

.empty {
  text-align: center;
  padding: 52px 20px;
  color: var(--ink-soft);
}
.empty p { margin: 0 0 16px; }

.toolbar {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
  margin-bottom: 18px;
}
.toolbar label.field { margin-bottom: 0; }
.toolbar .grow { flex: 1 1 240px; }

@media (max-width: 760px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .detail { grid-template-columns: 1fr; }
  .spec-list { grid-template-columns: 1fr; }
  .spec-list dt { padding-bottom: 0; border-bottom: none; }
  .suggestion { grid-template-columns: 1fr auto; }
  .suggestion .key { grid-column: 1 / -1; }

  .wrap { padding: 0 14px 48px; }
  .toolbar .grow { flex: 1 1 100%; }
  /* Undgaa at iOS zoomer ind naar et felt faar fokus. */
  input[type="text"], input[type="number"], input[type="url"], input[type="search"],
  select, textarea { font-size: 16px; }
  /* Stoerre trykflader til antal og handlinger. */
  .btn { padding: 10px 16px; }
  .btn-sm { padding: 8px 13px; }
  .btn-icon { width: 40px; height: 40px; }
  .qty .num { min-width: 44px; }
}

/* ------------------------------------------------------- billedstribe */

.shots { display: flex; gap: 10px; flex-wrap: wrap; }
.shot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 104px;
}
.shot img {
  width: 104px;
  height: 104px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  display: block;
}
.shot label {
  display: flex;
  gap: 5px;
  align-items: center;
  cursor: pointer;
  font-size: 12px;
}
.shot label input { width: auto; }

.thumb-wrap { position: relative; width: 42px; }
.thumb-count {
  position: absolute;
  right: -5px;
  bottom: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--moss);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 17px;
  text-align: center;
}

.nav-count {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  margin-left: 3px;
  border-radius: 9px;
  background: var(--warn);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
nav.main a.active .nav-count { background: rgba(255, 255, 255, 0.28); }

/* -------------------------------------------------- frie specifikationer */

.spec-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto;
  gap: 8px;
  margin-bottom: 8px;
}
@media (max-width: 620px) {
  .spec-row { grid-template-columns: minmax(0, 1fr) auto; }
  .spec-row input[name="spec_value"] { grid-column: 1; }
  .spec-row button { grid-row: 1 / span 2; align-self: stretch; }
}
