:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #0a66c2;
  --accent-soft: #e8f1fb;
  --ok: #0f7b4b;
  --ok-soft: #e4f5ec;
  --bad: #b42318;
  --bad-soft: #fdecea;
  --warn: #a15c07;
  --warn-soft: #fff4e0;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317; --surface: #1a1d23; --text: #e8eaed; --muted: #9aa1ac; --line: #2a2e36;
    --accent: #4c9be8; --accent-soft: #16273a; --ok: #4cc38a; --ok-soft: #13291f;
    --bad: #f07167; --bad-soft: #321a1a; --warn: #f0b35a; --warn-soft: #2e2413;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 24px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 10px; }
code { font-size: 12px; background: var(--bg); padding: 2px 5px; border-radius: 4px; word-break: break-all; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--bad); }
.mt { margin-top: 28px; }

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 24px; padding: 0 24px; height: 60px;
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); }
.brand.big { font-size: 20px; justify-content: center; margin-bottom: 20px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a { padding: 8px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.topbar nav a:hover { background: var(--bg); color: var(--text); }
.topbar nav a.active { background: var(--accent-soft); color: var(--accent); }
.account { margin-left: auto; display: flex; align-items: center; gap: 16px; font-size: 14px; }
.li-pill { padding: 4px 10px; border-radius: 99px; font-size: 13px; font-weight: 500; }
.li-pill.ok { background: var(--ok-soft); color: var(--ok); }
.li-pill.bad { background: var(--bad-soft); color: var(--bad); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 24px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.back { font-size: 13px; display: inline-block; margin-bottom: 4px; }
.section-title { margin: 36px 0 12px; }

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

/* Knapper og felter */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.full { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 14px; }
input[type=text], input[type=url], input[type=password], input[type=datetime-local], select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-weight: 400;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.inline { display: inline; }

/* Flash */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 20px; font-size: 14px; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.bad { background: var(--bad-soft); color: var(--bad); }
.flash.warn { background: var(--warn-soft); color: var(--warn); }

/* Stats og faner */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; }
.stat .n { font-size: 26px; font-weight: 700; }
.stat .n.small { font-size: 15px; font-weight: 600; padding: 7px 0 3px; }
.stat .l { color: var(--muted); font-size: 13px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; white-space: nowrap; }
.tabs a.active { color: var(--accent); border-color: var(--accent); }
.count { background: var(--bg); border-radius: 99px; padding: 1px 8px; font-size: 12px; margin-left: 4px; }

/* Lister */
.list { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 16px; align-items: flex-start; color: var(--text); padding: 16px 20px; }
a.row:hover { border-color: var(--accent); }
.row-main { flex: 1; min-width: 0; }
.row-meta { display: flex; align-items: center; gap: 10px; font-size: 13px; margin-bottom: 6px; }
.row-actions { display: flex; gap: 6px; }
.excerpt { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.empty { text-align: center; padding: 48px; }

.badge { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--bg); color: var(--muted); }
.badge.approved { background: var(--accent-soft); color: var(--accent); }
.badge.published, .badge.sent, .badge.manual { background: var(--ok-soft); color: var(--ok); }
.badge.failed { background: var(--bad-soft); color: var(--bad); }
.badge.publishing { background: var(--warn-soft); color: var(--warn); }

/* Editor */
.editor-grid { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }
.ai-panel { position: sticky; top: 80px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 99px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.ai-status { margin: 10px 0 0; min-height: 1em; }
.counter { font-size: 12px; color: var(--muted); margin: -8px 0 16px; }
.counter.over { color: var(--bad); font-weight: 600; }

.preview { border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 8px; background: var(--bg); }
.preview-head { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; font-size: 14px; }
.preview-head img, .avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--line); display: inline-block; }
.preview-body { font-size: 14px; overflow-wrap: anywhere; }
.preview-body .tag { color: var(--accent); font-weight: 600; }
.see-more { border: 0; background: none; color: var(--muted); font: inherit; cursor: pointer; padding: 0; }
.see-more:hover { color: var(--accent); text-decoration: underline; }

.schedule { display: flex; gap: 10px; align-items: flex-end; padding: 16px; margin-top: 16px; border-radius: 10px; background: var(--accent-soft); }
.schedule label { margin: 0; flex: 1; }

.suggestions { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.suggestion { text-align: left; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 10px; padding: 12px 14px 12px 44px; font: inherit; font-size: 14px; cursor: pointer; position: relative; white-space: pre-line; }
.suggestion:hover { border-color: var(--accent); }
.suggestion.picked { border-color: var(--accent); background: var(--accent-soft); }
.suggestion .n { position: absolute; left: 14px; top: 12px; width: 20px; height: 20px; border-radius: 50%; background: var(--bg); font-size: 12px; font-weight: 700; display: grid; place-items: center; }

/* Indstillinger */
.settings-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 20px; align-items: start; }
.li-account { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.li-account img { width: 48px; height: 48px; border-radius: 50%; }
.checklist { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.checklist li { padding: 6px 0 6px 26px; position: relative; }
.checklist li::before { position: absolute; left: 0; font-weight: 700; }
.checklist li.ok::before { content: "✓"; color: var(--ok); }
.checklist li.bad::before { content: "✕"; color: var(--bad); }
.log { font-size: 13px; padding: 12px 20px; }
.log-row { padding: 6px 0; border-bottom: 1px solid var(--line); }
.log-row:last-child { border: 0; }
.log-row.error { color: var(--bad); }

/* Login */
.login { min-height: 80vh; display: grid; place-items: center; }
.login .card { width: 100%; max-width: 360px; padding: 32px; }

/* Mobil */
@media (max-width: 860px) {
  .topbar { padding: 0 16px; gap: 12px; height: auto; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
  .topbar nav { order: 3; width: 100%; overflow-x: auto; }
  .wrap { padding: 20px 16px 48px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .editor-grid, .settings-grid { grid-template-columns: 1fr; }
  .ai-panel { position: static; }
  .schedule { flex-direction: column; align-items: stretch; }
  .row { flex-direction: column; }
}
