/* Båtsida CMS – publik design */
:root {
  --accent: #1f4e79;
  --header: #1f4e79;
  --on-header: #fff;
  --on-accent: #fff;
  --link: #1f4e79;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #5d6877;
  --line: #e1e5eb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161d; --surface: #1a2029; --text: #e5e9ef; --muted: #9aa5b4; --line: #2b3440;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4); color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.6 var(--font); color: var(--text); background: var(--bg); display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; padding-bottom: 3rem; }
a { color: var(--link); text-underline-offset: 2px; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.25; margin: 1.6em 0 .5em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); margin-top: .4em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 820px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); padding: .5rem 1rem; z-index: 99; }

/* Knappar & formulär */
.btn { display: inline-block; background: var(--accent); color: var(--on-accent) !important; border: 0; border-radius: 8px; padding: .6rem 1.1rem; font: 600 .95rem var(--font); text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(1.1); }
.btn-block { display: block; width: 100%; }
.badge { display: inline-block; vertical-align: middle; font-size: .72rem; font-weight: 600; letter-spacing: .02em; padding: .15rem .5rem; border-radius: 99px; background: var(--line); color: var(--muted); }
.alert { padding: .75rem 1rem; border-radius: 8px; background: #e7f4ea; color: #1d5a2b; }
.alert-error { background: #fdecec; color: #8a1c1c; }
input, select, textarea { font: inherit; color: inherit; }

/* Sidhuvud */
.site-header { background: var(--header); color: var(--on-header); position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 0 rgba(0, 0, 0, .1); }
.header-inner { display: flex; align-items: center; gap: 1rem; min-height: 60px; }
.brand { display: flex; align-items: center; gap: .55rem; color: var(--on-header) !important; text-decoration: none; font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.brand-mark { width: 28px; height: 28px; }
.site-nav { display: flex; align-items: center; gap: 1rem; margin-left: auto; }
.site-nav > ul { display: flex; list-style: none; margin: 0; padding: 0; gap: .15rem; }
.site-nav li { position: relative; }
.site-nav a { display: block; color: var(--on-header) !important; text-decoration: none; padding: .45rem .75rem; border-radius: 6px; opacity: .9; }
.site-nav a:hover, .site-nav a[aria-current] { background: color-mix(in srgb, var(--on-header) 14%, transparent); opacity: 1; }
.site-nav .sub { display: none; position: absolute; top: 100%; left: 0; min-width: 210px; list-style: none; margin: 0; padding: .4rem; background: var(--surface); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .15); }
.site-nav .sub a { color: var(--text) !important; }
.site-nav .sub a:hover { background: var(--bg); }
.has-sub:hover .sub, .has-sub:focus-within .sub { display: block; }
.search input { width: 150px; padding: .4rem .7rem; border-radius: 6px; border: 0; background: color-mix(in srgb, var(--on-header) 14%, transparent); color: var(--on-header); }
.search input::placeholder { color: var(--on-header); opacity: .7; }
.search input:focus { outline: 2px solid var(--on-header); background: color-mix(in srgb, var(--on-header) 22%, transparent); }
.nav-toggle { display: none; margin-left: auto; background: color-mix(in srgb, var(--on-header) 15%, transparent); color: var(--on-header); border: 0; border-radius: 6px; padding: .45rem .8rem; font: inherit; cursor: pointer; }

@media (max-width: 820px) {
  .nav-toggle { display: block; }
  .site-nav { display: none; position: absolute; left: 0; right: 0; top: 60px; background: var(--header); flex-direction: column; align-items: stretch; padding: .5rem 16px 1rem; gap: .5rem; }
  .nav-open .site-nav { display: flex; }
  .site-nav > ul { flex-direction: column; }
  .site-nav .sub { display: block; position: static; background: none; box-shadow: none; padding: 0 0 0 1rem; }
  .site-nav .sub a { color: var(--on-header) !important; }
  .site-nav .sub a:hover { background: color-mix(in srgb, var(--on-header) 14%, transparent); }
  .search input { width: 100%; }
}

/* Startsida */
.hero { background: linear-gradient(135deg, var(--header), color-mix(in srgb, var(--header) 70%, #000)); color: var(--on-header); position: relative; overflow: hidden; }
.hero .hero-text { position: relative; padding: 3.5rem 16px 3rem; }
.hero.has-image { min-height: 340px; display: flex; align-items: flex-end; }
.hero.has-image .hero-text { padding-top: 8rem; }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; max-width: none; }
.hero.has-image::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, .65), rgba(0, 0, 0, 0) 70%); }
.hero.has-image .hero-text { z-index: 1; }
.hero h1 { margin: 0; color: inherit; }
.hero.has-image { color: #fff; }
.hero.has-image h1 { text-shadow: 0 1px 8px rgba(0, 0, 0, .25); }
.tagline { margin: .3rem 0 0; font-size: 1.15rem; opacity: .92; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 2.5rem; margin-top: 2rem; }
@media (max-width: 820px) { .home-grid { grid-template-columns: 1fr; gap: 1rem; } }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.2rem 1.3rem; margin-bottom: 1.2rem; }
.card h2 { margin: 0 0 .8rem; font-size: 1.05rem; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: 0; font-size: .95rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; text-align: center; }
.stats > div { background: var(--bg); border-radius: 8px; padding: .7rem .3rem; }
.stat-num { display: block; font-size: 1.45rem; font-weight: 700; color: var(--link); font-variant-numeric: tabular-nums; }
.stat-label { font-size: .78rem; color: var(--muted); }
.stats-wide { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin: 1.2rem 0 1.5rem; }
.stats-wide > div { background: var(--surface); box-shadow: var(--shadow); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.section-head h2 { margin-bottom: .8rem; }
.log-cards { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.log-cards a { display: grid; grid-template-columns: 130px 1fr; gap: .1rem 1rem; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: .85rem 1.1rem; color: var(--text) !important; text-decoration: none; border-left: 4px solid var(--accent); }
.log-cards a:hover { transform: translateY(-1px); }
.log-cards .log-date { grid-row: span 2; color: var(--muted); font-size: .9rem; }
.log-meta { color: var(--muted); font-size: .9rem; }
@media (max-width: 520px) { .log-cards a { grid-template-columns: 1fr; } .log-cards .log-date { grid-row: auto; } }

/* AIS-knapp */
.ais-btn { display: inline-flex; align-items: center; gap: .55rem; margin-top: 1.4rem; padding: .8rem 1.3rem; border-radius: 99px; background: #fff; color: var(--accent) !important; font-weight: 700; font-size: 1.05rem; text-decoration: none; box-shadow: 0 4px 18px rgba(0, 0, 0, .22); transition: transform .15s, box-shadow .15s; }
.ais-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0, 0, 0, .28); }
.ais-btn svg { width: 22px; height: 22px; flex: none; }
.ais-btn::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); animation: ais-pulse 2s infinite; order: 3; }
.ais-ext { font-weight: 400; opacity: .7; order: 4; }
@keyframes ais-pulse { 70% { box-shadow: 0 0 0 9px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
@media (prefers-reduced-motion: reduce) { .ais-btn::before { animation: none; } }
@media (max-width: 520px) { .ais-btn { width: 100%; justify-content: center; } }

/* Dagbok */
.diary-list { list-style: none; padding: 0; margin: 1.5rem 0; display: grid; gap: .9rem; }
.diary-card { display: grid; grid-template-columns: 1fr; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; color: var(--text) !important; text-decoration: none; }
.diary-card.with-img { grid-template-columns: 180px 1fr; }
.diary-card img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.diary-body { display: flex; flex-direction: column; gap: .25rem; padding: 1rem 1.2rem; }
.diary-body strong { font-size: 1.1rem; }
.diary-body .log-date { color: var(--muted); font-size: .88rem; }
.diary-excerpt { color: var(--muted); font-size: .95rem; }
.diary-card:hover strong { color: var(--link); }
@media (max-width: 560px) { .diary-card.with-img { grid-template-columns: 1fr; } .diary-card img { height: 160px; } }
.diary-entry .content { font-size: 1.07rem; line-height: 1.75; }

/* Servicebok */
.tabs-small { margin-top: .5rem; }
.tabs-small a { font-size: .82rem; padding: .25rem .7rem; }
.service-table tfoot td { background: var(--bg); border-bottom: 0; }
.purchase-list { padding-left: 1.2rem; }
.purchase-list li { padding: .15rem 0; }
.file-list { list-style: none; padding: 0; }
.file-list li { padding: .4rem 0; border-bottom: 1px solid var(--line); }
.file-list a { text-decoration: none; font-weight: 600; }

/* Utrustning & sidhuvudknappar */
.head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.btn-ghost { background: var(--surface); color: var(--text) !important; box-shadow: inset 0 0 0 1px var(--line); }
.btn-ghost:hover { filter: none; box-shadow: inset 0 0 0 1px var(--muted); }
.eq-cat { margin: 2rem 0 .6rem; font-size: 1.15rem; }
.eq-table td { vertical-align: top; }
.eq-table .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }
.due-late { color: #b42318; font-weight: 700; }
.due-soon { color: #a35a00; font-weight: 700; }
.notice { background: #fff7e6; color: #7a4a00; border: 1px solid #f5d9a8; border-radius: 8px; padding: .75rem 1rem; margin-bottom: 1rem; }
@media (prefers-color-scheme: dark) { .notice { background: #3a2c12; color: #f5d9a8; border-color: #5c4520; } }

/* Innehåll */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 1.5rem; }
.page-head h1 { margin: 0; }
.crumbs { margin-top: 1.5rem; font-size: .9rem; color: var(--muted); }
.page-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2.5rem; max-width: 860px; }
.page-layout.with-side { grid-template-columns: minmax(0, 1fr) 240px; max-width: 1120px; }
@media (max-width: 820px) { .page-layout.with-side { grid-template-columns: 1fr; } }
.side-nav { margin-top: 4.5rem; }
.side-nav h2 { font-size: .95rem; margin: 0 0 .5rem; text-transform: uppercase; letter-spacing: .05em; }
.side-nav h2 a { color: var(--muted); text-decoration: none; }
.side-nav ul { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.side-nav a { display: block; padding: .3rem .9rem; text-decoration: none; color: var(--text); margin-left: -2px; border-left: 2px solid transparent; }
.side-nav a[aria-current] { border-color: var(--accent); color: var(--link); font-weight: 600; }
.content { overflow-wrap: break-word; }
.content > :first-child { margin-top: 0; }
.content table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: .95rem; display: block; overflow-x: auto; }
.content th, .content td { border: 1px solid var(--line); padding: .5rem .7rem; text-align: left; vertical-align: top; }
.content th { background: var(--bg); }
.content blockquote { margin: 1.2rem 0; padding: .8rem 1.1rem; background: var(--surface); border-left: 4px solid var(--accent); border-radius: 0 8px 8px 0; box-shadow: var(--shadow); }
.content img { border-radius: 8px; }
.content .img-left { float: left; max-width: 45%; margin: .3rem 1.2rem .8rem 0; }
.content .img-right { float: right; max-width: 45%; margin: .3rem 0 .8rem 1.2rem; }
.content .img-center { display: block; margin: 1rem auto; }
.content .img-full { display: block; width: 100%; margin: 1rem 0; }
.content::after { content: ""; display: table; clear: both; }
.content .file-link::before { content: "📄 "; }
.content hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
.content pre { background: var(--surface); padding: 1rem; border-radius: 8px; overflow-x: auto; }
@media (max-width: 520px) { .content .img-left, .content .img-right { float: none; max-width: 100%; margin: 1rem 0; } }
.child-list { list-style: none; padding: 0; margin: 2rem 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem; }
.child-list a { display: block; height: 100%; background: var(--surface); box-shadow: var(--shadow); border-radius: var(--radius); padding: 1rem 1.1rem; text-decoration: none; color: var(--text); border-top: 3px solid var(--accent); }
.child-list strong { display: block; color: var(--link); margin-bottom: .2rem; }
.child-list span { font-size: .9rem; color: var(--muted); }
.updated { margin-top: 2.5rem; font-size: .85rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 1rem; }


/* Bildstorlek (w-10 … w-100) och bildtext */
.content .w-10, .editor-area .w-10 { width: 10% !important; max-width: 100% !important; }
.content .w-15, .editor-area .w-15 { width: 15% !important; max-width: 100% !important; }
.content .w-20, .editor-area .w-20 { width: 20% !important; max-width: 100% !important; }
.content .w-25, .editor-area .w-25 { width: 25% !important; max-width: 100% !important; }
.content .w-30, .editor-area .w-30 { width: 30% !important; max-width: 100% !important; }
.content .w-35, .editor-area .w-35 { width: 35% !important; max-width: 100% !important; }
.content .w-40, .editor-area .w-40 { width: 40% !important; max-width: 100% !important; }
.content .w-45, .editor-area .w-45 { width: 45% !important; max-width: 100% !important; }
.content .w-50, .editor-area .w-50 { width: 50% !important; max-width: 100% !important; }
.content .w-55, .editor-area .w-55 { width: 55% !important; max-width: 100% !important; }
.content .w-60, .editor-area .w-60 { width: 60% !important; max-width: 100% !important; }
.content .w-65, .editor-area .w-65 { width: 65% !important; max-width: 100% !important; }
.content .w-70, .editor-area .w-70 { width: 70% !important; max-width: 100% !important; }
.content .w-75, .editor-area .w-75 { width: 75% !important; max-width: 100% !important; }
.content .w-80, .editor-area .w-80 { width: 80% !important; max-width: 100% !important; }
.content .w-85, .editor-area .w-85 { width: 85% !important; max-width: 100% !important; }
.content .w-90, .editor-area .w-90 { width: 90% !important; max-width: 100% !important; }
.content .w-95, .editor-area .w-95 { width: 95% !important; max-width: 100% !important; }
.content .w-100, .editor-area .w-100 { width: 100% !important; max-width: 100% !important; }
.content img[class*="w-"], .editor-area img[class*="w-"] { height: auto; }
.content figure, .editor-area figure { display: table; margin: 1.2rem 0; max-width: 100%; }
.content figure img, .editor-area figure img { display: block; max-width: 100%; height: auto; margin: 0; float: none; }
.content figure[class*="w-"], .editor-area figure[class*="w-"] { display: block; }
.content figure[class*="w-"] img, .editor-area figure[class*="w-"] img, .content figure.img-full img, .editor-area figure.img-full img { width: 100%; }
.content figure.img-full, .editor-area figure.img-full { display: block; width: 100%; }
.content figure.img-center, .editor-area figure.img-center { margin-left: auto; margin-right: auto; }
.content figure.img-center:not([class*="w-"]), .editor-area figure.img-center:not([class*="w-"]) { display: table; }
.content figcaption, .editor-area figcaption { display: table-caption; caption-side: bottom; padding-top: .45rem; font-size: .88em; color: var(--muted); text-align: center; line-height: 1.45; }
.content figure[class*="w-"] figcaption, .editor-area figure[class*="w-"] figcaption, .content figure.img-full figcaption, .editor-area figure.img-full figcaption { display: block; }
.content .img-center[class*="w-"] { margin-left: auto; margin-right: auto; display: block; }
@media (max-width: 520px) {
  .content .img-left[class*="w-"], .content .img-right[class*="w-"] { width: 100% !important; }
  .content [class*="w-1"]:not(.w-100), .content .w-20, .content .w-25, .content .w-30, .content .w-35, .content .w-40, .content .w-45 { width: 60% !important; }
}

/* Loggbok */
.tabs { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: 1.2rem; }
.tabs a { padding: .35rem .9rem; border-radius: 99px; background: var(--surface); box-shadow: var(--shadow); text-decoration: none; color: var(--text); font-size: .92rem; }
.tabs a[aria-current] { background: var(--accent); color: var(--on-accent); }
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.log-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.log-table th, .log-table td { padding: .7rem .9rem; text-align: left; border-bottom: 1px solid var(--line); }
.log-table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--bg); }
.log-table tr:last-child td { border-bottom: 0; }
.log-table tbody tr:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.log-entry .log-date { margin: 1rem 0 0; color: var(--muted); }
.log-entry h1 { margin-top: .2rem; }
.log-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .6rem; margin: 1.5rem 0 2rem; }
.log-facts > div { background: var(--surface); box-shadow: var(--shadow); border-radius: 8px; padding: .6rem .9rem; }
.log-facts dt { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.log-facts dd { margin: .1rem 0 0; font-weight: 600; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .5rem; margin: 2rem 0; }
.gallery a { display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 8px; }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.gallery a:hover img { transform: scale(1.04); }
.pager { display: flex; justify-content: space-between; margin-top: 1.5rem; }
.lb { position: fixed; inset: 0; background: rgba(0, 0, 0, .92); z-index: 100; display: flex; align-items: center; justify-content: center; }
.lb[hidden] { display: none; }
.lb figure { margin: 0; max-width: 90vw; text-align: center; }
.lb img { max-height: 85vh; max-width: 90vw; border-radius: 4px; }
.lb figcaption { color: #ddd; margin-top: .5rem; }
.lb button { position: absolute; background: none; border: 0; color: #fff; font-size: 2.6rem; cursor: pointer; padding: 1rem; line-height: 1; }
.lb-close { top: 0; right: 0; }
.lb-prev { left: 0; }
.lb-next { right: 0; }
.lb-open { overflow: hidden; }

/* Sök */
.search-big { display: flex; gap: .5rem; margin-bottom: 1rem; }
.search-big input { flex: 1; padding: .6rem .9rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.search-hits { list-style: none; padding: 0; }
.search-hits li { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.search-hits p { margin: .3rem 0 0; color: var(--muted); font-size: .92rem; }

/* Sidfot */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); font-size: .88rem; color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-top: 1rem; padding-bottom: 1rem; }
.footer-inner p { margin: 0; }

/* Inloggning / installation */
.auth-page { align-items: center; justify-content: center; padding: 2rem 16px; background: linear-gradient(160deg, var(--bg), color-mix(in srgb, var(--accent) 12%, var(--bg))); }
.auth-box { flex: 0; width: 100%; max-width: 420px; background: var(--surface); border-radius: 14px; box-shadow: 0 10px 40px rgba(16, 24, 40, .12); padding: 2rem; }
.auth-brand { margin: 0; color: var(--link); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: .8rem; }
.auth-box h1 { font-size: 1.6rem; margin: .2rem 0 1rem; }
.form label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 1rem; }
.form input { display: block; width: 100%; margin-top: .3rem; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-weight: 400; }
.form input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.auth-back { margin: 1.2rem 0 0; text-align: center; font-size: .9rem; }
.checks { list-style: none; padding: 0; margin: 1rem 0; font-size: .9rem; }
.checks li { padding: .25rem 0; }
.checks .ok { color: #1d7a3a; }
.checks .warn { color: #a35a00; }
.checks small { display: block; color: var(--muted); margin-left: 1.2rem; }

/* Utskrift */
@media print {
  .site-header, .site-footer, .pager, .tabs, .updated, .btn, .crumbs { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .log-facts > div, .table-wrap, .stats-wide > div { box-shadow: none; border: 1px solid #ccc; }
}
