/* AquaBedrift — felles stilark. Mobil-først. */

:root {
  --primary: #137a8c;
  --primary-light: #1ba0b8;
  --primary-dark: #0c4754;
  --accent: #f08c2c;
  --accent-light: #ffb068;
  --bg: #f6f9fa;
  --surface: #ffffff;
  --surface-2: #eef4f6;
  --border: #d8e2e6;
  --border-strong: #b9c8cd;
  --text: #15252e;
  --muted: #6c7c84;
  --success: #1f9d63;
  --error: #c8323c;
  --warning: #c47b14;
  --shadow-1: 0 1px 2px rgba(12,71,84,0.05);
  --shadow-2: 0 4px 14px rgba(12,71,84,0.10);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --max: 1200px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { color: var(--primary-dark); margin: 0 0 .5em; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }

p { margin: 0 0 .8em; }

/* ── Knapper ───────────────────────────────────────────────────────────────── */
.btn, button.btn, .btn-link, input[type=submit] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .12s ease, background .12s;
  text-decoration: none;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:hover, .btn:focus { background: var(--primary-light); text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-accent { background: var(--accent); color: #1c1607; }
.btn-accent:hover { background: var(--accent-light); }
.btn-ghost { background: transparent; color: var(--primary); border: 1px solid var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { background: #a8232e; }
.btn-sm { padding: 8px 14px; font-size: .85rem; }
.btn-lg { padding: 16px 28px; font-size: 1.05rem; }
.btn-block { width: 100%; }

/* ── Inputs ────────────────────────────────────────────────────────────────── */
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date],
input[type=password], input[type=url], select, textarea {
  width: 100%;
  padding: 11px 14px;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(19,122,140,.18);
}
textarea { resize: vertical; min-height: 90px; font-family: inherit; }

label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; color: var(--text); }
.field { margin-bottom: 16px; }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }

.checkbox, .radio { display: flex; align-items: flex-start; gap: 10px; padding: 10px; border-radius: var(--radius-sm); cursor: pointer; }
.checkbox:hover, .radio:hover { background: var(--surface-2); }
.checkbox input, .radio input { margin-top: 3px; flex-shrink: 0; width: 18px; height: 18px; accent-color: var(--primary); }

.checkbox-grid { display: grid; gap: 8px; }

/* ── Layout ────────────────────────────────────────────────────────────────── */
.container { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
  padding: 18px;
  margin-bottom: 16px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.card-title { margin: 0; font-size: 1.05rem; }

/* ── Tabell ────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { padding: 12px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
th { background: var(--surface-2); font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
tr:hover td { background: var(--surface-2); }

/* ── Badger ────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 999px;
  font-size: .75rem; font-weight: 600; line-height: 1.4;
  background: var(--surface-2); color: var(--muted);
}
.badge.new { background: #cfe9d5; color: #1f6b3a; }
.badge.code_created { background: #fce6c6; color: #8a570b; }
.badge.code_sent { background: #d2e7ed; color: var(--primary-dark); }
.badge.confirmed { background: #c8e5f0; color: var(--primary-dark); }
.badge.invoiced { background: #e0d4f5; color: #5a3aa8; }
.badge.completed { background: #cfe9d5; color: #1f6b3a; }
.badge.archived { background: #e0e7ea; color: var(--muted); }
.badge.draft { background: var(--surface-2); color: var(--muted); }
.badge.testing { background: #fce6c6; color: #8a570b; }
.badge.ready { background: #cfe9d5; color: #1f6b3a; }
.badge.sending { background: #c8e5f0; color: var(--primary-dark); }
.badge.paused { background: #fcd9c6; color: #8a370b; }
.badge.cancelled { background: #f5cdd0; color: var(--error); }

/* ── Flash ─────────────────────────────────────────────────────────────────── */
.flashes { position: fixed; top: 16px; right: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.flash {
  padding: 14px 18px; border-radius: var(--radius-sm);
  background: #fff; border: 1px solid var(--border);
  box-shadow: var(--shadow-2); font-weight: 500;
  animation: slideIn .25s ease-out;
}
.flash.success { border-left: 4px solid var(--success); }
.flash.error { border-left: 4px solid var(--error); }
.flash.info { border-left: 4px solid var(--primary); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { to { transform: translateX(20px); opacity: 0; } }

/* ── Admin layout ──────────────────────────────────────────────────────────── */
.admin-body { padding-bottom: env(safe-area-inset-bottom); }
.admin-shell { display: flex; min-height: 100vh; position: relative; }

/* Mobil top-bar (skjules på desktop) */
.mobile-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; background: var(--primary-dark); color: #fff;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.mobile-header .mobile-brand {
  display: flex; align-items: center; gap: 10px;
  color: #fff; text-decoration: none; font-weight: 800;
  font-size: 1rem;
}
.mobile-header .mobile-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent); color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: .85rem;
}
.mobile-header .muted { color: rgba(255,255,255,.7) !important; }
.hamburger {
  background: transparent; border: 0; cursor: pointer;
  width: 44px; height: 44px; padding: 0;
  display: flex; flex-direction: column; gap: 5px;
  align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.hamburger span {
  display: block; width: 22px; height: 2.5px; background: #fff; border-radius: 2px;
  transition: transform .2s, opacity .2s;
}
body.nav-open .hamburger span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
body.nav-open .hamburger span:nth-child(2) { opacity: 0; }
body.nav-open .hamburger span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }
body.nav-open { overflow: hidden; }

.nav-backdrop {
  position: fixed; inset: 0;
  background: rgba(12,71,84,.5);
  z-index: 90;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.nav-backdrop.open { opacity: 1; pointer-events: auto; }

.admin-nav {
  width: 240px;
  background: var(--primary-dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 14px 0;
  flex-shrink: 0;
}
.admin-nav .logo {
  width: auto; height: 44px;
  background: var(--accent);
  color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 1.1rem;
  margin: 0 14px 14px;
  border-radius: 12px;
  letter-spacing: -.5px;
  text-decoration: none;
}
.admin-nav .nav-link {
  display: flex; align-items: center; gap: 12px;
  height: 46px; margin: 3px 12px;
  padding: 0 14px;
  border-radius: 10px;
  color: rgba(255,255,255,.78);
  transition: background .15s, color .15s;
  text-decoration: none;
  font-size: .95rem;
  background: transparent;
  border: 0;
  font-family: inherit;
  cursor: pointer;
  width: calc(100% - 24px);
  text-align: left;
}
.admin-nav .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.admin-nav .nav-link.active { background: var(--accent); color: var(--primary-dark); font-weight: 600; }
.admin-nav .nav-icon {
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
}
.admin-nav .spacer { flex: 1; min-height: 12px; }
.admin-nav .nav-link.logout { color: rgba(255,255,255,.45); }

.admin-main { flex: 1; min-width: 0; }
.admin-header {
  padding: 12px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  position: sticky; z-index: 50;
}
.admin-header h1 { font-size: 1.1rem; margin: 0; }
.admin-content { padding: 16px 14px 80px; }

.test-mode-banner {
  background: var(--accent); color: var(--primary-dark);
  text-align: center; padding: 8px 14px;
  font-size: .85rem; font-weight: 600;
  position: sticky; top: 0; z-index: 110;
}

/* ── Mobil (<900px): top-bar + off-canvas drawer ─────────────────────────── */
@media (max-width: 899px) {
  .mobile-header { display: flex; }
  .admin-shell { display: block; }
  .admin-nav {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 78%; max-width: 300px;
    z-index: 95;
    transform: translateX(-100%);
    transition: transform .25s ease-out;
    overflow-y: auto;
    padding-top: env(safe-area-inset-top);
  }
  .admin-nav.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.25); }
  .admin-header { top: 0; }
  .admin-header h1 { font-size: 1rem; }
  .admin-content { padding: 14px 12px 80px; }
  .test-mode-banner { font-size: .8rem; padding: 6px 12px; }
}

/* ── Desktop (≥900px): permanent sidebar ─────────────────────────────────── */
@media (min-width: 900px) {
  .mobile-header { display: none; }
  .admin-nav {
    position: sticky;
    top: 0;
    height: 100vh;
  }
  .admin-header { top: 0; padding: 14px 24px; }
  .admin-header h1 { font-size: 1.15rem; }
  .admin-content { padding: 20px 24px 80px; }
}

/* ── Stats ─────────────────────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 18px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-1);
}
.stat-card .label { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.stat-card .value { font-size: 2rem; font-weight: 800; color: var(--primary-dark); letter-spacing: -.02em; }

/* ── Diverse ───────────────────────────────────────────────────────────────── */
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row.center { justify-content: center; }
.row.end { justify-content: flex-end; }
.gap-0 { gap: 0; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.mt-0 { margin-top: 0; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0 !important; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface-2); padding: 2px 6px; border-radius: 4px; }
hr.divider { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }

.progress {
  height: 8px; background: var(--surface-2);
  border-radius: 999px; overflow: hidden; margin: 8px 0;
}
.progress > div { height: 100%; background: var(--primary); transition: width .4s; }

/* ── Bryterpunkter ─────────────────────────────────────────────────────────── */
@media (max-width: 639px) {
  .card { padding: 14px; }
  .card-header { margin-bottom: 10px; }
  h1 { font-size: 1.35rem; }
  h2 { font-size: 1.15rem; }
  th, td { padding: 10px 8px; font-size: .9rem; }
  .stat-card .value { font-size: 1.7rem; }
  .btn { padding: 11px 18px; font-size: .92rem; }
  .btn-lg { padding: 14px 22px; font-size: 1rem; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 12px; }
  .row { gap: 8px; }
  .form-grid { display: flex; flex-direction: column; gap: 12px; }
}
@media (min-width: 640px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .form-grid .full { grid-column: 1 / -1; }
}
@media (min-width: 900px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ── Landingsside ──────────────────────────────────────────────────────────── */
.landing-shell { background: var(--bg); }
.public-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.public-header .brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; color: var(--primary-dark);
}
.public-header .brand .mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 900;
}
.public-header .hashtag { font-size: .68rem; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.lang-toggle { display: flex; gap: 4px; }
.lang-toggle a {
  padding: 6px 10px; border-radius: 6px; font-size: .85rem;
  color: var(--muted); font-weight: 600;
}
.lang-toggle a.active { background: var(--primary-dark); color: #fff; }
.lang-toggle a:hover { text-decoration: none; }

.hero {
  padding: 48px 16px 36px;
  background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: #fff;
  text-align: center;
}
.hero h1 { color: #fff; font-size: 1.9rem; margin-bottom: .4em; letter-spacing: -.02em; }
.hero p { color: rgba(255,255,255,.88); max-width: 560px; margin: 0 auto 1.2em; font-size: 1.05rem; }
.hero .btn { background: var(--accent); color: var(--primary-dark); }
.hero .btn:hover { background: var(--accent-light); }
@media (min-width: 700px) {
  .hero { padding: 80px 16px 64px; }
  .hero h1 { font-size: 2.7rem; }
}

section.section { padding: 40px 16px; }
section.section.alt { background: var(--surface); }
section.section h2 { text-align: center; margin-bottom: 24px; }

.steps { display: grid; gap: 16px; max-width: 920px; margin: 0 auto; }
.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
}
.step .n {
  display: inline-flex; width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: var(--primary-dark);
  align-items: center; justify-content: center;
  font-weight: 900; margin-bottom: 10px;
}
@media (min-width: 700px) {
  .steps { grid-template-columns: repeat(3, 1fr); }
}

.race-grid { display: grid; gap: 12px; max-width: 920px; margin: 0 auto; }
.race-card {
  display: flex; gap: 12px; padding: 16px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .15s;
}
.race-card:has(input:checked) { border-color: var(--primary); background: #e9f2f5; }
.race-card input { margin-top: 4px; width: 22px; height: 22px; accent-color: var(--primary); flex-shrink: 0; }
.race-card .body { flex: 1; min-width: 0; }
.race-card .title { font-weight: 700; color: var(--primary-dark); margin-bottom: 2px; }
.race-card .meta { font-size: .88rem; color: var(--muted); }
.race-card .tag {
  display: inline-block; margin-top: 6px; padding: 2px 8px; border-radius: 6px;
  font-size: .7rem; background: var(--surface-2); color: var(--muted); text-transform: uppercase;
}

.lead-form {
  max-width: 640px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
  box-shadow: var(--shadow-2);
}
.honeypot { position: absolute; left: -9999px; opacity: 0; pointer-events: none; }

.pt-block {
  max-width: 920px; margin: 0 auto;
  background: linear-gradient(135deg, #fef3e2 0%, #ffe8d0 100%);
  border: 1px solid #f0d2a5;
  border-radius: var(--radius-lg);
  padding: 28px;
}
.pt-block h2 { color: #8a570b; text-align: left; margin-bottom: 8px; }
.pt-block .pt-sub { color: #6b481d; margin-bottom: 18px; }
.pt-block .pt-grid { display: grid; gap: 12px; }
.pt-item {
  background: #fff; padding: 14px; border-radius: var(--radius-sm);
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; text-decoration: none; color: var(--text);
}
.pt-item:hover { background: #fffaf3; text-decoration: none; }
.pt-item .pt-arrow { color: var(--accent); font-weight: 700; }
@media (min-width: 700px) {
  .pt-block .pt-grid { grid-template-columns: repeat(2, 1fr); }
}

.faq details {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 8px;
  max-width: 720px; margin-left: auto; margin-right: auto;
}
.faq summary { font-weight: 600; cursor: pointer; padding: 4px 0; color: var(--primary-dark); }

footer.public-footer {
  background: var(--primary-dark); color: rgba(255,255,255,.8);
  padding: 28px 16px; text-align: center;
  font-size: .9rem;
}
footer.public-footer a { color: var(--accent-light); }

/* ── Auth ─────────────────────────────────────────────────────────────────── */
.auth-shell {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}
.auth-card {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 32px; max-width: 420px; width: 100%;
  box-shadow: 0 16px 40px rgba(0,0,0,.18);
}
.auth-card h1 { text-align: center; margin-bottom: 6px; }
.auth-card .sub { text-align: center; color: var(--muted); margin-bottom: 24px; }
.auth-card .footer-links { margin-top: 16px; text-align: center; font-size: .85rem; color: var(--muted); }

/* ── PWA install hint ──────────────────────────────────────────────────────── */
.install-hint { padding: 10px 16px; background: var(--surface-2); border-radius: var(--radius-sm); font-size: .85rem; color: var(--muted); }
