:root {
  --brand: #0f4c5c; --brand-dark: #0b3a46; --brand-soft: #e4eff2;
  --accent: #2b8a3e; --accent-dark: #237032; --accent-soft: #e6f4e9;
  --bg: #f3f6f8; --card: #ffffff; --line: #dfe5ea; --text: #1d2a33; --muted: #5d6b76;
  --warn: #b45309; --warn-soft: #fdf1dc; --danger: #b42318; --danger-soft: #fdeceb; --star: #e8a200;
  --radius: 12px; --shadow: 0 1px 3px rgba(15, 40, 55, .08);
  font-family: "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
a { color: var(--brand); }
h1 { font-size: 28px; margin: 0; color: var(--brand); line-height: 1.2; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 6px; }
[hidden] { display: none !important; }

/* Skal */
.top { position: fixed; inset: 0 0 auto 0; height: 60px; background: var(--brand); color: #fff; display: flex; align-items: center; gap: 16px; padding: 0 20px; z-index: 20; }
.logo { font-weight: 700; font-size: 20px; color: #fff; text-decoration: none; white-space: nowrap; }
.logo span { color: #a5e3b2; }
.top .search { margin-left: auto; width: min(260px, 30vw); }
.top input { width: 100%; border: 0; border-radius: 8px; padding: 9px 12px; font: inherit; }
.wallet { background: var(--brand-dark); color: #fff; padding: 8px 12px; border-radius: 8px; text-decoration: none; font-weight: 600; white-space: nowrap; }
.who { background: none; border: 0; color: #fff; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.menu-btn { display: none; background: none; border: 0; color: #fff; font-size: 24px; cursor: pointer; padding: 0 4px; }
.side { position: fixed; top: 60px; bottom: 0; left: 0; width: 232px; background: var(--card); border-right: 1px solid var(--line); overflow-y: auto; padding: 10px 0 24px; z-index: 15; }
.side a { display: flex; justify-content: space-between; align-items: center; padding: 10px 20px; text-decoration: none; color: var(--text); }
.side a:hover { background: var(--bg); }
.side a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.side .sub { padding-left: 34px; font-size: 14px; }
.side .grp { padding: 16px 20px 4px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.main { margin: 60px 0 0 232px; padding: 24px; max-width: 1240px; }
.head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.head p { margin: 4px 0 0; color: var(--muted); }
.count { background: var(--accent); color: #fff; border-radius: 10px; font-size: 12px; font-weight: 700; padding: 0 7px; line-height: 18px; }

/* Kort og gitter */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-bottom: 16px; }
.grid .card { margin: 0; }
.two { display: grid; gap: 16px; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; }
.stat { font-size: 30px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.right { margin-left: auto; }
.empty { text-align: center; padding: 44px 16px; color: var(--muted); }
.empty strong { display: block; color: var(--text); margin-bottom: 6px; }

/* Knapper og felter */
.btn { display: inline-block; background: var(--brand); color: #fff; border: 0; border-radius: 8px; padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--brand-dark); }
.btn.go { background: var(--accent); }
.btn.go:hover { background: var(--accent-dark); }
.btn.ghost { background: var(--brand-soft); color: var(--brand); }
.btn.ghost:hover { background: #d5e6ea; }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); text-decoration: underline; cursor: pointer; }
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 14px; }
label .hint { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=url], input[type=search], input[type=datetime-local], select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 9px 11px; border: 1px solid #c9d2d9; border-radius: 8px; font: inherit; font-weight: 400; background: #fff; color: var(--text);
}
textarea { min-height: 96px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, .link:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; margin-bottom: 8px; }
.check input { margin-top: 4px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0 12px; margin: 6px 0 14px; }
.formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 14px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.filters select, .filters input { margin: 0; width: auto; min-width: 150px; flex: 1 1 150px; }

/* Tabeller */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td select { margin: 0; min-width: 150px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.plus { color: var(--accent-dark); }
.minus { color: var(--danger); }

/* Mærker */
.tag { display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: 13px; font-weight: 600; background: var(--brand-soft); color: var(--brand); white-space: nowrap; }
.tag.ok { background: var(--accent-soft); color: var(--accent-dark); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--danger-soft); color: var(--danger); }
.notice { background: var(--warn-soft); color: #7a3e06; border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; }
.notice.info { background: var(--brand-soft); color: var(--brand-dark); }
.stars { color: var(--star); letter-spacing: 1px; white-space: nowrap; }
.scorebox { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; border: 2px solid var(--brand); border-radius: 10px; width: 88px; height: 76px; }
.scorebox b { font-size: 24px; color: var(--warn); line-height: 1.1; }
.scorebox.good b { color: var(--accent-dark); }
.bar { height: 7px; background: var(--line); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }

/* To-do */
.todo { list-style: none; margin: 0; padding: 0; }
.todo li { display: flex; gap: 10px; padding: 7px 0; align-items: flex-start; }
.todo .dot { flex: none; width: 18px; height: 18px; border: 2px solid #b9c4cc; border-radius: 50%; margin-top: 2px; }
.todo .done .dot { background: var(--accent); border-color: var(--accent); }
.todo .done a { color: var(--muted); text-decoration: line-through; }

/* Markedsplads */
.market { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 16px; align-items: start; }
.lead-card { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.lead-card .info { flex: 1 1 280px; min-width: 0; }
.lead-card .buy { text-align: right; flex: none; }
.lead-card .price { font-size: 20px; font-weight: 700; }

/* Chat */
.chat { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; min-height: 480px; }
.chat .list a { display: block; padding: 12px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); }
.chat .list a.on { background: var(--brand-soft); }
.bubbles { display: flex; flex-direction: column; gap: 8px; max-height: 430px; overflow-y: auto; margin-bottom: 12px; }
.bubble { max-width: 78%; padding: 9px 13px; border-radius: 12px; background: var(--bg); white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.me { align-self: flex-end; background: var(--brand); color: #fff; }
.bubble small { display: block; opacity: .75; font-size: 12px; margin-top: 2px; }

/* Kalender */
.day { display: flex; gap: 16px; padding: 14px 8px; border-bottom: 1px solid var(--line); min-height: 64px; }
.day:last-child { border: 0; }
.day .d { width: 62px; flex: none; display: flex; gap: 8px; align-items: center; height: 36px; font-size: 13px; color: var(--muted); }
.day .d b { font-size: 16px; color: var(--text); width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; }
.day.today .d b { background: var(--brand); color: #fff; }
.appt { display: block; width: 100%; text-align: left; background: var(--brand-soft); color: var(--brand-dark); border: 0; border-radius: 8px; padding: 7px 11px; margin-bottom: 6px; font: inherit; cursor: pointer; }
.day .items { flex: 1; min-width: 0; }

/* Dialog og besked */
dialog { border: 0; border-radius: var(--radius); padding: 24px; width: min(580px, 94vw); max-height: 90vh; box-shadow: 0 12px 40px rgba(0,0,0,.25); color: var(--text); }
dialog::backdrop { background: rgba(15, 40, 55, .45); }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #1d2a33; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 100; max-width: 90vw; }
.err { color: var(--danger); font-size: 14px; margin: 0 0 10px; }

/* Login */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(160deg, var(--brand) 0, var(--brand-dark) 60%); }
.auth .box { background: #fff; border-radius: 14px; padding: 28px; width: min(460px, 100%); }
.auth .logo { color: var(--brand); display: block; margin-bottom: 14px; }
.auth .logo span { color: var(--accent); }
.hp { position: absolute; left: -9999px; }

/* Faktura */
.invoice { max-width: 760px; }
.invoice table { margin: 18px 0; }

@media (max-width: 900px) {
  .menu-btn { display: block; }
  .side { transform: translateX(-100%); transition: transform .15s; width: 260px; box-shadow: 4px 0 14px rgba(0,0,0,.15); }
  .side.open { transform: none; }
  .main { margin-left: 0; padding: 16px; }
  .top { padding: 0 12px; gap: 10px; }
  .top .search, .who { display: none; }
  .wallet { margin-left: auto; }
  .two, .market, .chat { grid-template-columns: minmax(0, 1fr); }
  .lead-card .buy { text-align: left; width: 100%; }
  h1 { font-size: 24px; }
}
@media print {
  .top, .side, .noprint { display: none !important; }
  .main { margin: 0; padding: 0; max-width: none; }
  body { background: #fff; }
  .card { box-shadow: none; padding: 0; }
}
