/* Havn — felles stilark */

:root {
  --bg: #1c1e25;
  --bg-2: #24262e;
  --bg-3: #2d2f39;
  --line: #363943;
  --line-2: #454956;
  --text: #f6f5f2;
  --text-2: #b8bac2;
  --text-3: #868a95;
  --gold: #e0be63;
  --gold-2: #f2d489;
  --gold-soft: rgba(224,190,99,0.14);
  --danger: #ea7461;
  --ok: #63bd7a;
  --font: "Switzer", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --display: "Switzer", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --r: 8px;
  --r-lg: 12px;
  --max: 1120px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; letter-spacing: -0.01em; }
h1, h2, .display { font-family: var(--display); font-weight: 600; letter-spacing: -0.025em; }
p { margin: 0; }

::selection { background: var(--gold); color: #111; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

.hopp { position: absolute; left: -9999px; top: 0; z-index: 300; background: var(--gold); color: #1a1508; padding: 10px 18px; border-radius: 0 0 var(--r) 0; font-size: 14px; font-weight: 500; }
.hopp:focus { left: 0; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }

/* ---------- Typografi ---------- */
.display { font-weight: 600; letter-spacing: -0.03em; line-height: 1.04; }
.eyebrow { font-size: 13px; color: var(--text-2); font-weight: 500; }
.eyebrow b { color: var(--gold); font-weight: 500; }
.lede { font-size: 17px; color: var(--text-2); max-width: 54ch; line-height: 1.6; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.link { color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.link:hover { text-decoration-color: var(--gold); }

/* ---------- Topplinje ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(28, 30, 37, 0.84);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 24px; }
.brand { display: flex; align-items: center; gap: 9px; font-family: var(--display); font-weight: 600; font-size: 18px; letter-spacing: -0.01em; white-space: nowrap; }
.brand svg { width: 26px; height: 26px; flex: none; }
.brand .amp { color: var(--gold); }
.brand small { font-weight: 400; font-size: 13px; color: var(--text-3); letter-spacing: 0; margin-left: 10px; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { font-size: 14px; color: var(--text-2); padding: 7px 11px; border-radius: 6px; transition: color 0.15s, background 0.15s; }
.nav a:hover { color: var(--text); background: var(--bg-3); }
.nav a[aria-current="page"] { color: var(--text); }
.nav-user { display: flex; align-items: center; gap: 12px; margin-left: 12px; padding-left: 16px; border-left: 1px solid var(--line); }
.nav-user .who { font-size: 13px; color: var(--text-3); }
.nav-user .who b { color: var(--text-2); font-weight: 500; }

.menu-toggle { display: none; background: none; border: 1px solid var(--line-2); border-radius: 6px; width: 38px; height: 34px; position: relative; }
.menu-toggle span, .menu-toggle span::before, .menu-toggle span::after { content: ""; position: absolute; left: 10px; width: 16px; height: 1.5px; background: var(--text); }
.menu-toggle span { top: 16px; }
.menu-toggle span::before { top: -5px; left: 0; }
.menu-toggle span::after { top: 5px; left: 0; }

/* ---------- Knapper ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--r);
  border: 1px solid transparent; font-size: 14px; font-weight: 500;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.2s var(--ease);
  white-space: nowrap;
}
.btn-gold { background: var(--gold); color: #1a1508; box-shadow: 0 1px 0 rgba(255,255,255,0.3) inset, 0 8px 24px -10px rgba(224,190,99,0.55); }
.btn-gold:hover { background: var(--gold-2); }
.btn-white { background: var(--text); color: #1c1e25; }
.btn-white:hover { background: #fff; }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--text); }
.btn-ghost:hover { background: var(--bg-3); border-color: #555a68; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 6px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn .arrow { transition: transform 0.2s var(--ease); }
.btn:hover .arrow { transform: translateX(2px); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------- Seksjoner ---------- */
main { flex: 1; }
.section { padding: 88px 0; }
.section + .section { border-top: 1px solid var(--line); }
.section-head { margin-bottom: 48px; max-width: 640px; }
.section-head .display { font-size: clamp(32px, 4.4vw, 48px); margin: 12px 0 16px; }

/* ---------- Kort ---------- */
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.cell { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 28px; transition: border-color 0.2s; }
.cell:hover { border-color: var(--line-2); }
.cell .num { font-size: 13px; color: var(--text-3); margin-bottom: 36px; font-variant-numeric: tabular-nums; }
.cell h3 { font-size: 17px; margin-bottom: 8px; }
.cell p { color: var(--text-2); font-size: 14px; line-height: 1.6; }

/* ---------- Skjema ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 7px; font-weight: 500; }
.field input, .field textarea, .field select {
  width: 100%; height: 42px; background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r);
  color: var(--text); padding: 0 12px; font: inherit; font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field textarea { height: auto; padding: 10px 12px; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.field input::placeholder, .field textarea::placeholder { color: var(--text-3); }
.field .hint { font-size: 12.5px; color: var(--text-3); margin-top: 6px; }
.field.error input { border-color: var(--danger); }
.field .err { font-size: 12.5px; color: var(--danger); margin-top: 6px; display: none; }
.field.error .err { display: block; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.field label.check, .check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--text-2); font-weight: 400; line-height: 1.5; }
.check input { width: 15px; height: 15px; margin-top: 2px; accent-color: var(--gold); flex: none; }
.check a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }

.alert { border: 1px solid var(--line-2); background: var(--bg-2); padding: 11px 14px; font-size: 13.5px; color: var(--text-2); border-radius: var(--r); margin-bottom: 16px; display: none; }
.alert.show { display: block; }
.alert.danger { border-color: rgba(229,105,90,0.4); color: #f0a49b; }
.alert.ok { border-color: rgba(88,176,110,0.4); color: #9ad8a8; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }


/* ---------- Chat (delt: kundechat og adminpanel) ---------- */
.chat-messages { flex: 1; padding: 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.chat-messages > *:first-child { margin-top: auto; } /* meldingene ligger nederst, som i en vanlig chat */
.msg { max-width: 74%; display: flex; flex-direction: column; gap: 5px; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg .bubble { padding: 12px 16px; border-radius: 6px; font-size: 14.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.msg.them .bubble { background: var(--bg-2); border: 1px solid var(--line); }
.msg.me .bubble { background: var(--gold); color: #1a1508; }
.msg .meta { font-size: 11.5px; color: var(--text-3); }
.chat-form { border-top: 1px solid var(--line); padding: 16px 20px; display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.chat-form input { height: 44px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r); color: var(--text); padding: 0 14px; font: inherit; font-size: 15px; }
.chat-form input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.chat-form .btn { height: 44px; }
@media (max-width: 720px) { .msg { max-width: 88%; } }

/* ---------- Modal (bestilling, ny kunde) ---------- */
.modal { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,0.68); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: flex; align-items: flex-start; justify-content: center; padding: 8vh 20px 40px; overflow-y: auto; animation: fade 0.2s ease both; }
.modal-box { background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 14px; padding: 26px; width: 100%; max-width: 480px; box-shadow: 0 40px 90px -30px rgba(0,0,0,0.8); animation: pop 0.3s var(--ease) both; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.modal-head h3 { font-size: 20px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
.x { background: none; border: 0; color: var(--text-3); font-size: 20px; line-height: 1; padding: 0 4px; }
.x:hover { color: var(--text); }
.sum { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.sum-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 13px 16px; font-size: 14px; border-bottom: 1px solid var(--line); }
.sum-row:last-child { border-bottom: 0; }
.sum-row span { color: var(--text-2); }
.sum-row b { font-weight: 500; font-variant-numeric: tabular-nums; }
.sum-row.total { background: var(--bg-3); }
.sum-row.total b { font-family: var(--display); font-size: 20px; color: var(--gold); }
.kvitt { text-align: center; }
.kvitt h3 { font-size: 21px; margin-bottom: 8px; }
.kvitt p { color: var(--text-2); font-size: 14.5px; margin-bottom: 22px; }
.hake { width: 56px; height: 56px; margin: 4px auto 18px; border-radius: 50%; background: rgba(88,176,110,0.14); border: 1px solid rgba(88,176,110,0.45); display: flex; align-items: center; justify-content: center; }
.hake svg { width: 26px; height: 26px; fill: none; stroke: var(--ok); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 26; stroke-dashoffset: 26; animation: draw 0.5s 0.15s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- Bunn ---------- */
.footer { border-top: 1px solid var(--line); padding: 32px 0; color: var(--text-3); font-size: 13px; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: center; }
.footer a:hover { color: var(--text); }
.footer .links { display: flex; gap: 20px; }

/* Vent med å vise siden til innloggingen er sjekket */
body[data-protected]:not(.ready), body[data-admin]:not(.ready), body[data-public-only]:not(.ready) { visibility: hidden; }

/* ---------- Statusmerker ---------- */
.pill { display: inline-block; font-size: 12px; font-weight: 500; padding: 2px 9px; border-radius: 999px; background: var(--bg-3); color: var(--text-2); border: 1px solid var(--line-2); }
.pill.aktiv { color: #8ad49c; border-color: rgba(88,176,110,0.4); background: rgba(88,176,110,0.1); }
.pill.venter { color: var(--gold-2); border-color: rgba(224,190,99,0.4); background: var(--gold-soft); }
.pill.kansellert { color: #f0a49b; border-color: rgba(229,105,90,0.4); background: rgba(229,105,90,0.1); }
.pill.pause { color: #9cc3f0; border-color: rgba(120,170,230,0.4); background: rgba(120,170,230,0.1); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv span { color: var(--text-3); }
.kv b { font-weight: 500; }
.kv b.pill { justify-self: start; }
.empty { color: var(--text-3); font-size: 14px; padding: 24px; text-align: center; }
.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; }
.card h3 { font-size: 16px; margin-bottom: 16px; }

/* ---------- Scroll-avsløring ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Animasjon ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.rise { animation: rise 0.6s var(--ease) both; }
.rise-1 { animation-delay: 0.02s; } .rise-2 { animation-delay: 0.1s; } .rise-3 { animation-delay: 0.18s; } .rise-4 { animation-delay: 0.26s; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Responsivt ---------- */
@media (max-width: 900px) { .grid-3 { grid-template-columns: 1fr 1fr; } .section { padding: 64px 0; } }
@media (max-width: 720px) {
  .container { padding: 0 18px; }
  .menu-toggle { display: block; }
  .nav { display: none; position: absolute; top: 60px; left: 0; right: 0; background: var(--bg); border-bottom: 1px solid var(--line); flex-direction: column; align-items: stretch; gap: 2px; padding: 10px 18px 16px; }
  .nav.open { display: flex; }
  .nav a { padding: 11px 10px; font-size: 15px; }
  .nav-user { border-left: 0; margin: 8px 0 0; padding: 12px 10px 0; border-top: 1px solid var(--line); justify-content: space-between; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .cell { padding: 22px; }
  .section { padding: 52px 0; }
  .section-head { margin-bottom: 32px; }
}
