/* Design etter marstrand.no: marineblått (#14486A) og oransje (#E75121), lyse flater, rolig og direkte. */
:root {
  --navy: #14486A; --navy-dark: #0e3550; --orange: #E75121; --orange-text: #B83A12;
  --ink: #2b2b2b; --muted: #5f5f5f; --line: #d9dde1; --soft: #efefef; --bg: #fff; --card: #fff;
  --font: "Poppins", "Segoe UI", segoeui, Helvetica, Arial, sans-serif;
  --link: #14486A; --danger: #A3144F;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1a22; --card: #16242f; --ink: #eef2f5; --muted: #a9b6c0; --line: #2b3d4b; --soft: #1d2f3c; --link: #8cc3e6; --orange-text: #ff9a76; --danger: #ff8fb5;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.55 var(--font); color: var(--ink); background: var(--bg); min-height: 100dvh; display: flex; flex-direction: column; }
main { flex: 1; width: 100%; padding: 28px 16px 40px; max-width: 1200px; margin: 0 auto; }
h1 { font-size: 1.7rem; line-height: 1.2; margin: 0 0 6px; color: var(--navy); font-weight: 600; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) h1 { color: #fff; } }
h2 { font-size: 1.25rem; margin: 0; }
h3 { font-size: 1rem; margin: 18px 0 6px; }
a { color: var(--link); }
.muted { color: var(--muted); margin: 0; }
.small { font-size: .85rem; margin-top: 10px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--navy); color: #fff; padding: 8px 12px; border-radius: 6px; z-index: 10; }
.skip:focus { top: 8px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

/* Topp: marineblå flate med oransje strek, som marstrand.no */
.top { background: var(--navy); color: #fff; }
.top-in { max-width: 1200px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.top-line { height: 4px; background: var(--orange); }
.brand { color: #fff; text-decoration: none; display: flex; align-items: baseline; gap: 8px; }
.brand-name { font-weight: 700; letter-spacing: .18em; font-size: 1.15rem; }
.brand-sub { font-size: .95rem; opacity: .85; }
.nav { display: flex; gap: 4px; margin-right: auto; }
.nav a { color: #fff; text-decoration: none; padding: 8px 12px; border-radius: 6px; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.12); }
.nav a[aria-current="page"] { background: rgba(255,255,255,.18); box-shadow: inset 0 -3px 0 var(--orange); }
.who { display: flex; gap: 8px; margin-left: auto; align-items: center; }
.top .btn-ghost { color: #fff; border-color: rgba(255,255,255,.5); }
.top .btn-ghost:hover { background: rgba(255,255,255,.12); }

/* Knapper og skjema */
.btn { font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 6px; border: 2px solid transparent; cursor: pointer; min-height: 44px; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-dark); }
.btn-accent { background: var(--orange-text); color: #fff; }
.btn-accent:hover { background: #9c3010; }
.btn-ghost { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn-ghost:hover { background: var(--soft); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger.arm { background: var(--danger); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-ghost { color: #cfe6f5; border-color: #5d7f96; } :root:not([data-theme="light"]) .btn-primary { background: #2f7fb3; } :root:not([data-theme="light"]) .btn-danger.arm { color: #1a0a10; } }
.btn[disabled] { opacity: .55; cursor: default; }
label { display: block; font-weight: 600; margin: 14px 0 4px; }
input, textarea, select { font: inherit; width: 100%; padding: 10px 12px; border: 2px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); }
input:focus, textarea:focus { border-color: var(--navy); outline: none; box-shadow: 0 0 0 3px rgba(231,81,33,.35); }
input[type="checkbox"] { width: auto; margin-right: 6px; }
textarea { resize: vertical; }
.hint { color: var(--muted); font-size: .85rem; margin: 4px 0 0; }
.error { color: var(--danger); font-weight: 600; min-height: 1.2em; margin: 10px 0; }
.lead { color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 24px; box-shadow: 0 2px 10px rgba(20,72,106,.06); }
.narrow { max-width: 460px; margin: 24px auto; }
.actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* Mindmap og lister */
.bar { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tools input[type="search"] { width: 220px; }
.check { display: flex; align-items: center; margin: 0; font-weight: 500; }
.zoom { display: flex; gap: 6px; }
.zoom .btn { min-width: 44px; padding: 6px 12px; font-size: 1.2rem; }
.map-scroll { border: 1px solid var(--line); border-radius: 10px; background: var(--soft); overflow: auto; max-height: 76dvh; padding: 6px; }
#map { display: block; }
.mm-link { fill: none; stroke-width: 2; opacity: .55; }
.mm-root rect { fill: var(--navy); }
.mm-root-text { fill: #fff; font: 700 15px var(--font); }
.mm-theme-text { fill: #fff; font: 600 14px var(--font); }
.mm-count { fill: #fff; font: 600 11px var(--font); opacity: .85; }
.mm-leaf rect:first-child { fill: var(--card); stroke-width: 1.5; }
.mm-leaf { cursor: pointer; }
.mm-leaf:hover rect:first-child, .mm-leaf:focus-visible rect:first-child { stroke-width: 3; }
.mm-leaf.mine rect:first-child { stroke: var(--orange); stroke-width: 3; }
.mm-leaf:focus-visible { outline: none; }
.mm-leaf-text { fill: var(--ink); font: 400 13.5px var(--font); }
.mm-meta { fill: var(--muted); font: 500 11.5px var(--font); }
.mm-leaf.dim { opacity: .25; }

.group { margin: 22px 0; }
.group h2 { color: var(--navy); border-left: 6px solid var(--navy); padding-left: 10px; display: flex; gap: 8px; align-items: baseline; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .group h2 { color: #fff; } }
.group h2 small { color: var(--muted); font-weight: 400; font-size: .85rem; }
.pts { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.pt { background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--navy); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.pt.mine { border-left-color: var(--orange); }
.pt p { margin: 0; overflow-wrap: anywhere; }
.pt-meta { color: var(--muted); font-size: .85rem; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: auto; }
.pt .btn { padding: 4px 12px; min-height: 36px; font-size: .9rem; }
.chip { display: inline-block; background: var(--soft); border-radius: 99px; padding: 1px 10px; font-size: .8rem; }
.chip.mine { background: var(--orange-text); color: #fff; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }

/* Dialoger */
dialog { border: 0; border-radius: 12px; padding: 20px 22px 24px; width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); background: var(--card); color: var(--ink); box-shadow: 0 12px 40px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(14,53,80,.55); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.similar { background: var(--soft); border-radius: 8px; padding: 6px 14px 12px; margin-top: 14px; }
.similar ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.similar li { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; display: flex; gap: 10px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.similar li span { overflow-wrap: anywhere; flex: 1 1 200px; }
.done-list { padding-left: 20px; }
.done-list li { margin: 6px 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

.foot { text-align: center; background: var(--navy); color: #fff; padding: 14px 16px; display: flex; gap: 12px; justify-content: center; letter-spacing: .08em; text-transform: uppercase; font-size: .78rem; border-top: 4px solid var(--orange); }

/* Eier-siden */
.admin-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--line); }
.admin-row > :first-child { flex: 1 1 180px; overflow-wrap: anywhere; }
.linkbox { background: var(--soft); border-radius: 8px; padding: 10px 12px; overflow-wrap: anywhere; font-family: ui-monospace, Consolas, monospace; font-size: .9rem; }

@media (max-width: 640px) {
  .top-in { gap: 10px; }
  .nav { order: 3; width: 100%; }
  .tools input[type="search"] { width: 100%; }
  h1 { font-size: 1.45rem; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
.stack { margin-top: 16px; }
