:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #0e5a8a;
  --primary-dark: #0b4569;
  --accent: #f59e0b;
  --success: #15803d;
  --success-bg: #dcfce7;
  --error: #b91c1c;
  --error-bg: #fee2e2;
  --info-bg: #dbeafe;
  --warn-bg: #fef3c7;
  --swish: #ff2d55;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text); background: var(--bg); line-height: 1.55;
}
a { color: var(--primary); }
h1 { font-size: 1.8rem; margin: 0 0 .5rem; }
h2 { font-size: 1.3rem; margin: 1.5rem 0 .6rem; }
h3 { font-size: 1.05rem; margin: 1rem 0 .4rem; }
p { margin: .4rem 0 .8rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.container { max-width: 1040px; margin: 0 auto; padding: 0 1rem; }
.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }

/* Header */
.site-header { background: var(--primary); color: #fff; }
body.admin .site-header { background: #1e293b; }
.nav { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; padding: .8rem 1rem; }
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.15rem; }
.nav nav { display: flex; flex-wrap: wrap; gap: .2rem; align-items: center; }
.nav nav a, .nav nav button.link {
  color: #fff; text-decoration: none; padding: .35rem .7rem; border-radius: 8px; font-size: .95rem;
  background: none; border: 0; cursor: pointer; font-family: inherit;
}
.nav nav a:hover, .nav nav a.active, .nav nav button.link:hover { background: rgba(255,255,255,.16); }
.site-footer { margin-top: 3rem; padding: 1.5rem 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
main { padding-top: 1.5rem; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; margin-bottom: 1.2rem; }
.grid { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.tour-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.tour-card .img { height: 170px; background: linear-gradient(135deg, #0e5a8a, #38bdf8); background-size: cover; background-position: center; }
.tour-card .body { padding: 1.1rem 1.2rem 1.2rem; display: flex; flex-direction: column; flex: 1; }
.tour-card h2 { margin: 0 0 .3rem; font-size: 1.2rem; }
.tour-card .body p { flex: 1; }
.price { font-weight: 700; font-size: 1.15rem; }
.hero { padding: 2rem 0 1rem; }
.hero h1 { font-size: 2.2rem; }

/* Buttons */
.btn {
  display: inline-block; background: var(--primary); color: #fff; border: 0; border-radius: 8px;
  padding: .6rem 1.1rem; font-size: 1rem; font-weight: 600; cursor: pointer; text-decoration: none; font-family: inherit;
}
.btn:hover { background: var(--primary-dark); }
.btn.secondary { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn.secondary:hover { background: #eef5fa; }
.btn.danger { background: #fff; color: var(--error); border: 1px solid var(--error); }
.btn.danger:hover { background: var(--error-bg); }
.btn.success { background: var(--success); }
.btn.swish { background: var(--swish); }
.btn.swish:hover { background: #d81b48; }
.btn.sm { padding: .3rem .7rem; font-size: .85rem; }
.btn.block { display: block; width: 100%; text-align: center; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }

/* Forms */
label { display: block; font-weight: 600; margin: .8rem 0 .25rem; font-size: .95rem; }
label .hint { font-weight: 400; color: var(--muted); }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=password], input[type=date],
input[type=datetime-local], input[type=time], input[type=url], textarea, select {
  width: 100%; padding: .55rem .7rem; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 1rem; font-family: inherit; background: #fff;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid #7fb3d5; outline-offset: 1px; border-color: var(--primary); }
.row { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 600px) { .row { grid-template-columns: 1fr; } }
.checkbox { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.checkbox input { width: auto; }
.code-input { font-family: ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; }

/* Flash / alerts */
.flash { padding: .8rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-weight: 500; }
.flash-success { background: var(--success-bg); color: var(--success); }
.flash-error { background: var(--error-bg); color: var(--error); }
.flash-info { background: var(--info-bg); color: #1d4ed8; }
.alert { padding: .8rem 1rem; border-radius: 8px; margin: .5rem 0 1rem; }
.alert.error { background: var(--error-bg); color: var(--error); }
.alert.warn { background: var(--warn-bg); color: #92400e; }
.alert.info { background: var(--info-bg); color: #1e3a8a; }

/* Badges */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.badge.pending { background: var(--warn-bg); color: #92400e; }
.badge.awaiting_confirmation { background: var(--info-bg); color: #1e40af; }
.badge.paid { background: var(--success-bg); color: var(--success); }
.badge.cancelled { background: #e2e8f0; color: #475569; }
.badge.seats { background: #e0f2fe; color: #075985; }
.badge.full { background: var(--error-bg); color: var(--error); }
.badge.few { background: var(--warn-bg); color: #92400e; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tr.muted td { color: var(--muted); }
.table-wrap { overflow-x: auto; }
td.num, th.num { text-align: right; }

/* Departure list */
.dep-list { list-style: none; padding: 0; margin: 0; }
.dep-list li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.dep-list li:last-child { border-bottom: 0; }
.dep-list .when { font-weight: 600; }

/* Summary boxes */
.summary { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 1rem; }
.summary dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; margin: 0; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 500; }
.total { font-size: 1.4rem; font-weight: 700; }

/* Pay page */
.pay-grid { display: grid; gap: 1.2rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 720px) { .pay-grid { grid-template-columns: 1fr; } }
.swish-box { border: 2px solid var(--swish); border-radius: var(--radius); padding: 1.2rem; text-align: center; }
.swish-box img { max-width: 220px; display: block; margin: .5rem auto; }
.swish-box .amount { font-size: 2rem; font-weight: 800; }
.swish-box .num { font-size: 1.3rem; font-weight: 700; letter-spacing: .05em; }
.ref { font-family: ui-monospace, monospace; font-weight: 700; background: #f1f5f9; padding: .1rem .4rem; border-radius: 4px; }
.steps { padding-left: 1.2rem; margin: .5rem 0; }
.steps li { margin: .3rem 0; }

/* Admin */
.stats { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 1.2rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.stat .n { font-size: 1.8rem; font-weight: 700; }
.stat .l { color: var(--muted); font-size: .85rem; }
.page-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.filters input { width: auto; }
.filters a { padding: .3rem .7rem; border-radius: 999px; text-decoration: none; background: #e2e8f0; color: var(--text); font-size: .9rem; }
.filters a.active { background: var(--primary); color: #fff; }
.codes { display: grid; gap: .4rem; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.codes code { display: block; background: #f1f5f9; padding: .5rem; border-radius: 6px; font-size: 1.05rem; text-align: center; }
.progress { height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; min-width: 80px; }
.progress span { display: block; height: 100%; background: var(--primary); }
details summary { cursor: pointer; font-weight: 600; }
@media print {
  .site-header, .site-footer, .actions, .btn, form { display: none !important; }
  body { background: #fff; }
  .card { border: 0; }
}

/* Media / galleri */
.gallery { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); align-items: start; }
.gallery-item { display: block; border-radius: 8px; overflow: hidden; background: #0f172a; aspect-ratio: 4 / 3; }
.gallery-item img, .gallery-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Filmer behåller sitt eget format – stående mobilfilm ska inte fyllas ut med svart */
.gallery-item.video { background: transparent; aspect-ratio: 9 / 16; max-width: 300px; }
.gallery-item.video video { object-fit: contain; background: transparent; max-height: 70vh; }
.media-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin-top: 1rem; }
.media-item { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #f8fafc; }
.media-item.is-cover { border-color: var(--success); box-shadow: 0 0 0 2px var(--success-bg); }
.media-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: #0f172a; }
/* Filmen visas hel i admin – ingen svart utfyllnad, ljus bakgrund bakom */
.media-item video { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; display: block; background: #f1f5f9; }
.media-kind { position: absolute; top: .5rem; left: .5rem; pointer-events: none; }
.media-meta { padding: .4rem .6rem 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-actions { display: flex; gap: .3rem; flex-wrap: wrap; padding: .4rem .6rem .6rem; }
input[type=file] { width: 100%; padding: .5rem; border: 1px dashed #94a3b8; border-radius: 8px; background: #fff; }

/* Fokuspunkt för bildbeskärning */
.focus-form { margin: 0; }
.focus-target {
  display: block; width: 100%; aspect-ratio: 4 / 3; border: 0; padding: 0; margin: 0;
  background-color: #0f172a; background-size: cover; background-repeat: no-repeat;
  cursor: crosshair; position: relative;
}
.focus-dot {
  position: absolute; width: 20px; height: 20px; margin: -10px 0 0 -10px;
  border: 2px solid #fff; border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, .55), inset 0 0 0 2px rgba(15, 23, 42, .35);
}
.cover-preview { display: grid; gap: 1rem; grid-template-columns: 260px 1fr; align-items: end; margin-top: 1.2rem; }
@media (max-width: 700px) { .cover-preview { grid-template-columns: 1fr; } }
.cp-label { margin-bottom: .3rem; }
.cp-card, .cp-banner {
  border-radius: 8px; background-color: #0f172a; background-size: cover; background-repeat: no-repeat;
  border: 1px solid var(--line);
}
.cp-card { height: 170px; }
.cp-banner { height: 170px; }

/* Filter och summering i bokningslistan */
.filter-card { padding: 1rem 1.2rem; }
.filter-row { display: grid; gap: .8rem; grid-template-columns: 2fr 1.2fr 1fr 1fr auto; align-items: end; }
.filter-row label { margin-top: 0; }
.filter-actions { display: flex; gap: .5rem; }
@media (max-width: 900px) { .filter-row { grid-template-columns: 1fr 1fr; } .filter-actions { grid-column: 1 / -1; } }
.totals { margin-bottom: 1.2rem; }
.totals-grid { display: grid; gap: .8rem 1.5rem; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.totals-grid .l { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.totals-grid .v { display: block; font-weight: 600; font-size: 1.05rem; white-space: nowrap; }
.totals-grid .v.big { font-size: 1.3rem; font-weight: 700; }

/* Statistik */
.funnel { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.funnel-step { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem 1rem; flex: 1 1 140px; }
.funnel-step .n { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.funnel-step .l { color: var(--muted); font-size: .85rem; }
.funnel-arrow { color: var(--muted); font-weight: 600; white-space: nowrap; }
.funnel-arrow::before { content: '→ '; }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 160px; margin-top: .5rem; }
.bars .bar { flex: 1 1 0; max-width: 44px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.bars .bar span { display: block; width: 100%; background: var(--primary); border-radius: 3px 3px 0 0; opacity: .85; }
.bars .bar:hover span { opacity: 1; }
.bars .bar em { position: absolute; top: -1.1rem; font-size: .7rem; font-style: normal; color: var(--muted); opacity: 0; }
.bars .bar:hover em { opacity: 1; }
.bars-axis { display: flex; justify-content: space-between; margin-top: .3rem; }

/* Radioval i rensningsformuläret */
label.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; margin: .4rem 0; }
label.check input { width: auto; margin-top: .25rem; }
