:root {
  --bg: #f7f6f2;
  --paper: #ffffff;
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e3e0d8;
  --accent: #1f3a5f;
  --accent-2: #c69749;
  --ok: #2f7a3f;
  --warn: #b6731a;
  --bad: #a8332b;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px; line-height: 1.55;
}
a { color: var(--accent); }
a:hover { color: var(--accent-2); }

.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

.topbar { background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.brand { font-weight: 700; font-size: 22px; text-decoration: none; color: var(--accent); letter-spacing: 0.5px; }
.brand .dot { color: var(--accent-2); }
.mainnav { display: flex; gap: 18px; margin-left: 18px; flex: 1; flex-wrap: wrap; }
.mainnav a { text-decoration: none; color: var(--ink); padding: 6px 2px; border-bottom: 2px solid transparent; }
.mainnav a:hover { border-bottom-color: var(--accent-2); }
.userbar { display: flex; gap: 10px; align-items: center; }
.hello { color: var(--muted); font-size: 14px; }

.messages { padding: 8px 0; }
.msg { padding: 10px 14px; border-radius: 4px; margin-bottom: 8px; }
.msg-success { background: #e7f0e3; color: var(--ok); }
.msg-error, .msg-danger { background: #f4dedb; color: var(--bad); }
.msg-info { background: #e3ebf4; }

h1, h2, h3 { color: var(--accent); font-weight: 600; }
h1 { font-size: 28px; margin: 28px 0 10px; }
h2 { font-size: 22px; margin: 24px 0 10px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
h3 { font-size: 18px; margin: 18px 0 6px; }

.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 4px; padding: 20px; margin-bottom: 20px;
}
.card h2:first-child { margin-top: 0; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.stat { background: var(--paper); border: 1px solid var(--line); padding: 14px 16px; border-radius: 4px; }
.stat .n { font-size: 32px; font-weight: 700; color: var(--accent); line-height: 1; }
.stat .l { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-link { display: block; text-decoration: none; color: inherit; transition: box-shadow .15s, border-color .15s; }
.stat-link:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(31,58,95,0.10); }
.stat-link:hover .n { color: var(--accent-2); }

/* Artikkel-redigering */
.article-edit-form .tinymce, .article-edit-form textarea { width: 100%; }
.article-edit-form .publish-row { margin-top: 14px; }
.checkbox-label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-label input[type="checkbox"] { width: auto; }

/* AI-panel */
.ai-panel { background: #f9f7ef; border-left: 4px solid var(--accent-2); }
.ai-panel h3 { color: var(--accent); }
.ai-panel textarea { font-family: inherit; font-size: 14px; }
.ai-provider-select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 3px; background: #fff; }
.ai-status { display: none; padding: 10px 14px; margin-top: 12px; border-radius: 3px; font-size: 14px; }
.ai-status-info { background: #e3ebf4; color: var(--accent); }
.ai-status-success { background: #e7f0e3; color: var(--ok); }
.ai-status-error { background: #f4dedb; color: var(--bad); }

table { width: 100%; border-collapse: collapse; background: var(--paper); }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f1ede4; color: var(--accent); font-weight: 600; font-size: 14px; }
tr:hover td { background: #faf8f2; }

.btn, .btn-primary, .btn-ghost, .btn-danger {
  display: inline-block; padding: 8px 16px; border-radius: 3px; text-decoration: none;
  cursor: pointer; border: 1px solid var(--accent); background: var(--paper);
  color: var(--accent); font-family: inherit; font-size: 15px;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #15273f; color: #fff; }
.btn-ghost { border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn-danger:hover { background: #872820; color: #fff; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

form .row { margin-bottom: 14px; }
form label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
form input[type="text"], form input[type="email"], form input[type="password"],
form input[type="number"], form input[type="url"], form input[type="date"],
form textarea, form select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line);
  border-radius: 3px; font-family: inherit; font-size: 15px; background: #fff;
}
form textarea { font-family: inherit; }
form .help { color: var(--muted); font-size: 13px; margin-top: 3px; }
form .errors { color: var(--bad); font-size: 13px; margin-top: 3px; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.pill-lead { background: #e3ebf4; color: var(--accent); }
.pill-client { background: #e7f0e3; color: var(--ok); }
.pill-paused { background: #faedd6; color: var(--warn); }
.pill-former { background: #ede9e1; color: var(--muted); }
.pill-internal { background: #e8e4f5; color: #4a3b8a; }
.pill-draft { background: #ede9e1; color: var(--muted); }
.pill-ready { background: #e3ebf4; color: var(--accent); }
.pill-done { background: #e7f0e3; color: var(--ok); }
.pill-open { background: #faedd6; color: var(--warn); }
.pill-in_progress { background: #e3ebf4; color: var(--accent); }

.small { font-size: 13px; color: var(--muted); }
.muted { color: var(--muted); }
.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin: 14px 0; flex-wrap: wrap; }
.searchbar input[type="search"], .searchbar input[type="text"] { min-width: 240px; }
.footer { margin-top: 60px; padding: 20px 0; border-top: 1px solid var(--line); background: var(--paper); }

.login-wrap {
  max-width: 380px; margin: 80px auto; background: var(--paper);
  border: 1px solid var(--line); border-radius: 4px; padding: 30px;
}
.login-wrap h1 { text-align: center; margin-top: 0; }

.progress { background: var(--line); border-radius: 3px; height: 8px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); }

.q-block { border-left: 3px solid var(--line); padding: 6px 12px; margin: 10px 0; }
.q-block.required { border-left-color: var(--accent-2); }
.q-heading { border: none; background: #f1ede4; padding: 10px 14px; font-weight: 600; color: var(--accent); margin-top: 18px; }
.q-hidden { display: none; }
.kv { display: grid; grid-template-columns: 200px 1fr; gap: 6px 16px; }
.kv .k { color: var(--muted); font-size: 14px; }
.kv .v { word-break: break-word; }
pre.box { background: #f4f0e6; padding: 12px; border-radius: 3px; overflow-x: auto; white-space: pre-wrap; }

/* ===== Offentlige sider ===== */
.public-page { background: #fbfaf6; }
.public-header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.public-header-inner { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; gap: 32px; flex-wrap: wrap; }
.public-brand { text-decoration: none; color: var(--accent); display: flex; flex-direction: column; line-height: 1.2; }
.public-brand .brand-name { font-weight: 700; font-size: 19px; letter-spacing: 0.3px; }
.public-brand .brand-tag { font-size: 12px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; margin-top: 2px; }
.public-nav { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.public-nav a { color: var(--ink); text-decoration: none; font-size: 15px; padding: 4px 0; border-bottom: 2px solid transparent; }
.public-nav a:hover { border-bottom-color: var(--accent-2); }
.public-nav a.active { border-bottom-color: var(--accent); color: var(--accent); }
.public-nav .login-link { font-size: 13px; color: var(--muted); border: 1px solid var(--line); padding: 5px 12px; border-radius: 3px; }
.public-nav .login-link:hover { color: var(--accent); border-color: var(--accent); }
.public-nav .btn-ghost { padding: 5px 12px; font-size: 13px; }

.public-main { min-height: 60vh; }
.public-footer { background: #1a2638; color: #d9d5cc; padding: 36px 0 28px; margin-top: 0; }
.public-footer-inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; align-items: flex-end; }
.public-footer .ft-name { font-weight: 700; color: #fff; font-size: 16px; }
.public-footer .ft-sub { color: #b0aa9a; font-size: 13px; letter-spacing: 0.5px; }
.public-footer .ft-links { display: flex; gap: 18px; }
.public-footer .ft-links a { color: #d9d5cc; text-decoration: none; font-size: 14px; }
.public-footer .ft-links a:hover { color: var(--accent-2); }
.public-footer .ft-meta { color: #8a8472; }

/* Hero */
.hero { background: linear-gradient(180deg, #fbfaf6 0%, #f1ede4 100%); padding: 72px 0 88px; }
.hero-inner { display: grid; grid-template-columns: 1.4fr 1fr; gap: 56px; align-items: center; }
.hero .eyebrow { font-size: 12px; color: var(--accent-2); letter-spacing: 2.5px; text-transform: uppercase; margin-bottom: 14px; font-weight: 600; }
.hero h1 { font-size: 44px; line-height: 1.15; margin: 0 0 22px; color: var(--accent); font-weight: 600; }
.hero .lead { font-size: 19px; line-height: 1.55; color: #2a2a2a; max-width: 620px; }
.hero-cta { margin-top: 32px; display: flex; gap: 14px; flex-wrap: wrap; }
.hero-card { display: flex; justify-content: center; }
.hero-card-inner { background: var(--paper); border: 1px solid var(--line); border-radius: 4px; padding: 18px 18px 22px; box-shadow: 0 6px 26px rgba(31,58,95,0.10); text-align: center; min-width: 260px; max-width: 380px; }
.hero-photo { display: block; width: 100%; aspect-ratio: 4 / 5; overflow: hidden; border-radius: 3px; cursor: pointer; background: #ece8de; position: relative; user-select: none; -webkit-user-select: none; transition: transform .15s; }
.hero-photo img { width: 100%; height: 100%; object-fit: cover; object-position: center 28%; display: block; transition: transform .25s ease, filter .25s ease; }
.hero-photo:hover img { transform: scale(1.02); }
.hero-photo:active { transform: scale(0.985); }
.hero-photo-clicked img { transform: scale(1.04); }
.card-tagline { display: grid; gap: 6px; color: var(--accent); font-size: 14px; letter-spacing: 1px; text-transform: uppercase; margin-top: 18px; }

/* Page hero (om/tjenester/kontakt) */
.page-hero { background: linear-gradient(180deg, #fbfaf6 0%, #f1ede4 100%); padding: 60px 0 48px; }
.page-hero .eyebrow { font-size: 12px; color: var(--accent-2); letter-spacing: 2.5px; text-transform: uppercase; margin-bottom: 14px; font-weight: 600; }
.page-hero h1 { font-size: 38px; margin: 0 0 16px; color: var(--accent); font-weight: 600; line-height: 1.2; }
.page-hero .lead { font-size: 18px; color: #2a2a2a; max-width: 700px; }

/* Bands */
.band { padding: 56px 0; }
.band-light { background: #f5f1e7; }
.band-dark { background: #1f3a5f; color: #ece8de; }
.band-dark .band-title { color: #fff; }
.band-dark h3 { color: #fff; }
.band-dark p { color: #cec9ba; }
.band-dark .service-card { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.14); }
.band-dark .service-card:hover { background: rgba(255,255,255,0.10); }
.band-dark .service-card h3 { color: #ffffff; }
.band-dark .service-card p { color: #e3dfd2; }
.band-inner { }
.band-title { font-size: 28px; color: var(--accent); margin: 0 0 32px; font-weight: 600; }
.band-title.light { color: #fff; }
.band-cta { margin-top: 32px; }

.two-col { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 36px; }
.three-col h3 { font-size: 17px; color: var(--accent); margin: 0 0 8px; }
.three-col p { margin: 0; color: #3a3a3a; }
.two-col h2 { margin-top: 0; }

.service-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.service-card { background: var(--paper); border: 1px solid var(--line); border-radius: 4px; padding: 22px 22px 20px; transition: box-shadow .15s; }
.service-card:hover { box-shadow: 0 4px 18px rgba(0,0,0,0.06); }
.service-card h3 { color: var(--accent); margin: 0 0 8px; font-size: 17px; }
.service-card p { margin: 0; color: #3a3a3a; font-size: 14px; line-height: 1.5; }

.service-list { display: grid; gap: 36px; }
.service-row { background: var(--paper); border: 1px solid var(--line); border-radius: 4px; padding: 26px 28px; }
.service-row h2 { margin-top: 0; border-bottom: none; padding-bottom: 0; }
.service-row ul { margin: 12px 0 0; padding-left: 20px; color: #3a3a3a; }
.service-row li { margin-bottom: 4px; }

.stats-col { display: grid; gap: 18px; align-content: start; }
.stat-block { background: var(--paper); border: 1px solid var(--line); border-radius: 4px; padding: 18px 20px; }
.stat-num { display: block; font-size: 26px; font-weight: 700; color: var(--accent-2); line-height: 1; margin-bottom: 6px; }
.stat-lab { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 1px; }

.profile-dl { display: grid; grid-template-columns: 160px 1fr; gap: 10px 18px; margin: 0; }
.profile-dl dt { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.8px; }
.profile-dl dd { margin: 0; }

.bullet-list { padding-left: 20px; }
.bullet-list li { margin-bottom: 6px; }

.callout { background: #faf6eb; border-left: 4px solid var(--accent-2); padding: 14px 18px; margin-top: 24px; border-radius: 0 3px 3px 0; }

/* Artikler */
.article-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.article-card { background: var(--paper); border: 1px solid var(--line); border-radius: 4px; padding: 24px 26px; transition: box-shadow .15s; }
.article-card-draft { background: #fdfaf2; border-style: dashed; }
.article-card:hover { box-shadow: 0 4px 18px rgba(0,0,0,0.07); }
.article-card h2, .article-card h3 { margin: 0 0 8px; font-size: 19px; }
.article-card h2 a, .article-card h3 a { color: var(--accent); text-decoration: none; }
.article-card h2 a:hover, .article-card h3 a:hover { color: var(--accent-2); }
.article-card p { color: #3a3a3a; margin: 8px 0 4px; }
.article-meta { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.tag { display: inline-block; background: #f1ede4; color: var(--accent); padding: 1px 8px; border-radius: 10px; font-size: 12px; margin-right: 4px; }
.read-more { font-size: 14px; }

.article-hero h1 { margin-bottom: 12px; }
.article-hero .article-meta { margin-bottom: 16px; }
.article-body { max-width: 760px; padding: 0 24px; }
.article-body h2 { font-size: 24px; color: var(--accent); margin: 36px 0 12px; border-bottom: none; padding-bottom: 0; }
.article-body h3 { font-size: 19px; color: var(--accent); margin: 28px 0 10px; }
.article-body p { font-size: 17px; line-height: 1.7; margin: 0 0 16px; color: #1f1f1f; }
.article-body ul, .article-body ol { font-size: 17px; line-height: 1.7; padding-left: 22px; margin: 0 0 20px; }
.article-body li { margin-bottom: 8px; }
.article-body strong { color: #0e1f33; }
.article-body em { color: #3a3a3a; }
.article-body pre { background: #f4f0e6; padding: 14px 18px; border-radius: 4px; overflow-x: auto; }
.article-body code { background: #f4f0e6; padding: 2px 6px; border-radius: 3px; font-size: 0.92em; }
.article-body a { color: var(--accent); }
.article-body a:hover { color: var(--accent-2); }

/* Live editor */
.ledit-bar { position: sticky; top: 0; z-index: 100; background: #1f3a5f; color: #fff; padding: 10px 24px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; box-shadow: 0 2px 12px rgba(0,0,0,0.2); font-family: -apple-system, "Segoe UI", sans-serif; font-size: 14px; }
.ledit-bar strong { color: var(--accent-2); }
.ledit-bar a, .ledit-bar button { background: rgba(255,255,255,0.12); color: #fff; border: 1px solid rgba(255,255,255,0.25); padding: 5px 12px; border-radius: 3px; text-decoration: none; font-size: 13px; cursor: pointer; font-family: inherit; }
.ledit-bar a:hover, .ledit-bar button:hover:not(:disabled) { background: rgba(255,255,255,0.22); color: var(--accent-2); }
.ledit-bar button:disabled { opacity: 0.4; cursor: not-allowed; }
.ledit-bar .ledit-btn-primary { background: var(--accent-2); color: #1a1a1a; border-color: var(--accent-2); font-weight: 600; }
.ledit-bar .ledit-btn-primary:hover:not(:disabled) { background: #d6a657; color: #1a1a1a; }
.ledit-bar .ledit-spacer { flex: 1; }
.ledit-status { font-size: 13px; min-width: 80px; text-align: right; }
.ledit-status-info { color: #ffe6a7; }
.ledit-status-success { color: #a3e7a7; }
.ledit-status-error { color: #ffb0a0; }
.ledit-dirty { font-size: 13px; padding: 3px 10px; border-radius: 11px; font-weight: 600; cursor: default; }
.ledit-clean { background: rgba(163,231,167,0.18); color: #a3e7a7; }
.ledit-warn { background: rgba(255,176,160,0.22); color: #ffb6a0; animation: ledit-pulse 1.6s ease-in-out infinite; cursor: pointer; }
.ledit-warn:hover { background: rgba(255,176,160,0.32); }
@keyframes ledit-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.65; } }

/* Changes-panel */
.ledit-changes-panel { position: sticky; top: 52px; z-index: 99; background: #fdfaf2; border-bottom: 1px solid var(--line); box-shadow: 0 6px 20px rgba(0,0,0,0.10); max-height: 60vh; overflow-y: auto; font-family: -apple-system, "Segoe UI", sans-serif; font-size: 13px; }
.ledit-changes-header { display: flex; gap: 10px; align-items: center; padding: 10px 24px; background: var(--accent-2); color: #1a1a1a; }
.ledit-changes-header strong { font-size: 14px; }
.ledit-changes-x { background: rgba(0,0,0,0.08); color: #1a1a1a; border: 0; width: 26px; height: 26px; border-radius: 13px; cursor: pointer; font-size: 18px; line-height: 1; padding: 0; }
.ledit-changes-x:hover { background: rgba(0,0,0,0.18); }
.ledit-changes-list { padding: 6px 24px 16px; }
.ledit-change { display: grid; grid-template-columns: 200px 1fr auto; gap: 12px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ledit-change:last-child { border-bottom: none; }
.ledit-change-label { color: var(--accent); font-weight: 600; font-size: 13px; }
.ledit-change-label .small { color: var(--muted); font-weight: 400; display: block; margin-top: 2px; }
.ledit-diff { display: grid; grid-template-columns: 1fr 24px 1fr; gap: 8px; align-items: start; }
.ledit-diff-before, .ledit-diff-after { padding: 6px 10px; border-radius: 3px; max-height: 120px; overflow-y: auto; line-height: 1.45; word-break: break-word; }
.ledit-diff-before { background: #fbe5e0; color: #6b1f15; text-decoration: line-through; text-decoration-color: rgba(168,51,43,0.4); }
.ledit-diff-after { background: #e3f0dc; color: #1f4a23; }
.ledit-diff-arrow { color: var(--muted); padding-top: 4px; text-align: center; }
.ledit-diff-empty { color: var(--muted); font-style: italic; text-decoration: none; }
.ledit-undo-btn { background: #fff; border: 1px solid var(--line); padding: 6px 12px; border-radius: 3px; cursor: pointer; font-size: 12px; color: var(--accent); white-space: nowrap; align-self: start; }
.ledit-undo-btn:hover { border-color: var(--accent-2); color: var(--accent-2); }
.ledit-change-pulse { background: rgba(198,151,73,0.10); }

@media (max-width: 720px) {
  .ledit-change { grid-template-columns: 1fr; }
  .ledit-diff { grid-template-columns: 1fr; gap: 4px; }
  .ledit-diff-arrow { display: none; }
}

.ledit-editable { outline: 1px dashed rgba(31,58,95,0.35); outline-offset: 4px; transition: outline-color .15s, background-color .15s; cursor: text; }
.ledit-editable:hover { outline-color: var(--accent-2); background-color: rgba(198,151,73,0.06); }
.ledit-editable:focus { outline: 2px solid var(--accent-2); outline-offset: 4px; background-color: rgba(198,151,73,0.10); }
.ledit-url { outline-style: solid; }

.preview-bar { position: sticky; top: 0; z-index: 100; background: var(--accent-2); color: #1a1a1a; padding: 8px 24px; text-align: center; font-size: 13px; font-weight: 600; letter-spacing: 0.4px; }

/* Visuell preview i section-edit */
.section-preview-wrap { margin: 16px 0 24px; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: #fff; }
.section-preview-label { padding: 10px 16px; background: #faf8f2; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.section-preview-label strong { color: var(--accent); }
.section-preview { /* container for det innfelte seksjonen */ }
.section-preview > section { /* bevarer original styling */ }

.cta-band { text-align: center; }
.cta-band .lead { max-width: 640px; margin: 0 auto 24px; }
.cta-band .band-title { margin-bottom: 18px; }

@media (max-width: 820px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero h1 { font-size: 32px; }
  .two-col, .three-col { grid-template-columns: 1fr; gap: 28px; }
  .public-header-inner { padding: 14px 18px; }
  .profile-dl { grid-template-columns: 1fr; }
  .profile-dl dt { margin-top: 8px; }
}

