* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #0f1117;
  color: #e2e8f0;
  display: flex;
  min-height: 100vh;
}

a { color: #7dd3fc; }

nav.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #151824;
  border-right: 1px solid #2d3148;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
}
nav.sidebar h1 { font-size: 1.1rem; color: #7dd3fc; margin: 0 0 1.5rem; }
nav.sidebar a {
  display: block;
  padding: 0.6rem 0.7rem;
  border-radius: 6px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
}
nav.sidebar a:hover { background: #1e2230; color: #e2e8f0; }
nav.sidebar a.active { background: #1e2230; color: #38bdf8; font-weight: 600; }
nav.sidebar .spacer { flex: 1; }
nav.sidebar .user { font-size: 0.8rem; color: #64748b; margin-bottom: 0.5rem; word-break: break-all; }
nav.sidebar button.logout {
  background: none; border: 1px solid #2d3148; color: #94a3b8; border-radius: 6px;
  padding: 0.5rem; cursor: pointer; font-size: 0.85rem;
}
nav.sidebar button.logout:hover { background: #2d3148; color: #e2e8f0; }

main { flex: 1; padding: 2rem; max-width: 1100px; }
main h2 { color: #e2e8f0; margin-top: 0; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; gap: 1rem; }
.toolbar input[type="search"] {
  background: #151824; border: 1px solid #2d3148; color: #e2e8f0; padding: 0.5rem 0.7rem;
  border-radius: 6px; min-width: 220px;
}

button, .btn {
  background: #38bdf8; color: #0f1117; border: none; border-radius: 6px;
  padding: 0.55rem 1rem; font-weight: 600; cursor: pointer; font-size: 0.9rem;
}
button:hover { background: #7dd3fc; }
button.secondary { background: #2d3148; color: #e2e8f0; }
button.secondary:hover { background: #3a3f57; }
button.danger { background: #ef4444; color: #fff; }
button.danger:hover { background: #f87171; }

table { border-collapse: collapse; width: 100%; background: #151824; border-radius: 8px; overflow: hidden; }
th, td { text-align: left; padding: 0.65rem 0.9rem; border-bottom: 1px solid #2d3148; font-size: 0.9rem; }
th { color: #94a3b8; text-transform: uppercase; font-size: 0.72rem; letter-spacing: 0.05em; }
tr:last-child td { border-bottom: none; }
tr.row-clickable:hover { background: #1e2230; cursor: pointer; }
td.num { font-family: monospace; }
td.desc { color: #94a3b8; max-width: 360px; white-space: pre-line; }

.badge { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.75rem; }
.badge.aktiv { background: #14532d; color: #a3e635; }
.badge.opsagt { background: #713f12; color: #fbbf24; }
.badge.afsluttet { background: #334155; color: #94a3b8; }

.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 10;
}
.overlay.hidden { display: none; }
.modal {
  background: #151824; border: 1px solid #2d3148; border-radius: 10px;
  padding: 1.5rem; width: 420px; max-width: 90vw; max-height: 85vh; overflow-y: auto;
}
.modal h3 { margin-top: 0; }
.field { margin-bottom: 0.9rem; display: flex; flex-direction: column; gap: 0.3rem; }
.field label { font-size: 0.8rem; color: #94a3b8; }
.field input, .field select, .field textarea {
  background: #0f1117; border: 1px solid #2d3148; color: #e2e8f0; padding: 0.5rem;
  border-radius: 6px; font-size: 0.9rem; font-family: inherit;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.2rem; }
.error-msg { color: #f87171; font-size: 0.85rem; min-height: 1.2em; }

.item-row { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.4rem; }
.item-row .item-sum { width: 100px; flex-shrink: 0; text-align: right; font-family: monospace; font-size: 0.85rem; color: #94a3b8; }
.item-row .item-sum s { color: #64748b; font-size: 0.75rem; }
.item-row .item-qty { width: 60px !important; flex-shrink: 0; }
.item-row .item-dtype { flex: 0 0 115px; }
.item-row .item-dval { width: 80px; flex-shrink: 0; }
.item-row .item-dval:disabled { opacity: 0.4; }
.price-summary .hidden { display: none !important; }
.item-row select { flex: 1; width: 100%; min-width: 0; text-overflow: ellipsis; }
.item-row input[type="number"] { width: 70px; }
.item-row button { padding: 0.3rem 0.6rem; }

.login-wrap { margin: auto; width: 320px; }
.login-wrap h1 { color: #7dd3fc; text-align: center; }
.login-wrap .modal { width: 100%; }

.hint { color: #64748b; font-size: 0.8rem; }

.modal.wide { width: 820px; }
.modal table th, .modal table td { padding: 0.45rem 0.6rem; font-size: 0.82rem; }
.modal h4 { margin: 1.4rem 0 0.6rem; color: #94a3b8; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }
.toolbar select, .modal #subs-filter {
  background: #151824; border: 1px solid #2d3148; color: #e2e8f0; padding: 0.5rem 0.7rem;
  border-radius: 6px; font-size: 0.9rem; font-family: inherit;
}
.price-summary { background: #0f1117; border: 1px solid #2d3148; border-radius: 6px; padding: 0.6rem 0.8rem; margin-bottom: 0.9rem; }
.price-summary > div:not(.hint) { display: flex; justify-content: space-between; padding: 0.2rem 0; font-size: 0.9rem; }
.price-summary .num { font-family: monospace; }
.price-summary .total { border-top: 1px solid #2d3148; margin-top: 0.3rem; padding-top: 0.45rem; font-weight: 600; color: #38bdf8; }
.price-summary .hint:empty { display: none; }

/* Tilbud */
.modal.xwide { width: 1100px; }
.field-row { display: flex; gap: 0.8rem; }
.field-row > .field { flex: 1; min-width: 0; }
.search-wrap { position: relative; }
.search-wrap input { width: 100%; }
.suggestions {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 20; margin-top: 2px;
  background: #151824; border: 1px solid #2d3148; border-radius: 6px; max-height: 320px; overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.suggestions.hidden { display: none; }
.suggestion { display: flex; gap: 0.8rem; padding: 0.5rem 0.7rem; cursor: pointer; font-size: 0.88rem; }
.suggestion.active, .suggestion[data-i]:hover { background: #1e2230; }
.suggestion .sku { width: 90px; flex-shrink: 0; color: #7dd3fc; }
.suggestion .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggestion .num { color: #94a3b8; font-family: monospace; }
table.quote-lines { background: #0f1117; }
table.quote-lines td { padding: 0.35rem 0.45rem; vertical-align: middle; }
table.quote-lines input, table.quote-lines select {
  background: #151824; border: 1px solid #2d3148; color: #e2e8f0; padding: 0.35rem;
  border-radius: 5px; font-size: 0.85rem; font-family: inherit; width: 100%;
}
table.quote-lines input:disabled, table.quote-lines select:disabled { opacity: 0.55; }
table.quote-lines .l-qty { width: 60px; }
table.quote-lines .l-price { width: 100px; }
table.quote-lines .l-discount { display: flex; gap: 0.3rem; white-space: nowrap; }
table.quote-lines .l-dtype { width: 55px; }
table.quote-lines .l-dval { width: 75px; }
table.quote-lines .l-sum { width: 110px; font-size: 0.82rem; color: #94a3b8; }
table.quote-lines .l-sum s { color: #64748b; font-size: 0.75rem; }
table.quote-lines button { padding: 0.25rem 0.55rem; }
th.r, td.r { text-align: right; }
#no-lines { padding: 0.6rem 0; }
#no-lines.hidden, .locked-msg.hidden, .convert-box.hidden, .modal-actions .hidden { display: none; }
.locked-msg { background: #14532d33; border: 1px solid #14532d; color: #a3e635; padding: 0.6rem 0.8rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.85rem; }
.convert-box {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.8rem;
  background: #0f1117; border: 1px solid #38bdf8; border-radius: 6px; padding: 0.6rem 0.8rem; font-size: 0.88rem;
}
.convert-box input { background: #151824; border: 1px solid #2d3148; color: #e2e8f0; padding: 0.4rem; border-radius: 6px; }
.badge.q-kladde { background: #334155; color: #cbd5e1; }
.badge.q-sendt { background: #0c4a6e; color: #7dd3fc; }
.badge.q-accepteret { background: #14532d; color: #a3e635; }
.badge.q-afvist { background: #7f1d1d; color: #fca5a5; }
.ok-msg { color: #a3e635; font-size: 0.85rem; min-height: 1.2em; }
nav.sidebar .version { font-size: 0.75rem; color: #64748b; font-family: monospace; margin-left: 0.3rem; }
.changelog h4 { margin: 1.4rem 0 0.3rem; color: #e2e8f0; font-size: 0.95rem; }
.changelog h4 .hint { font-weight: 400; margin-left: 0.5rem; }
.changelog ul { margin: 0; padding-left: 1.2rem; color: #94a3b8; font-size: 0.9rem; line-height: 1.6; }
