/* Kappseil — mobile-first, responsive, light/dark. */
:root {
  --navy: #0b3954; --teal: #2ec4b6; --amber: #f4a261; --red: #d1495b; --green: #2a9d8f;
  --bg: #f2f6f8; --card: #ffffff; --text: #14262f; --muted: #5d7380; --line: #dde6ea;
  --primary: #0b3954; --primary-text: #fff; --radius: 14px; --shadow: 0 1px 2px rgba(11, 57, 84, .08), 0 4px 14px rgba(11, 57, 84, .06);
  --nav-h: 62px; --side-w: 220px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0c1a22; --card: #14262f; --text: #e8f0f3; --muted: #93a8b3; --line: #254250; --primary: #2ec4b6; --primary-text: #062029; --shadow: none; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.45; font-size: 16px; }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; } h2 { font-size: 1.15rem; margin: 0 0 .5rem; } h3 { margin: 0 0 .35rem; }
a { color: var(--primary); } p { margin: .4rem 0; }
code { background: var(--line); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; } .pad { padding: 2rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.pre { white-space: pre-wrap; } .danger-text { color: var(--red) !important; }
[hidden] { display: none !important; }

/* ───── Layout ───── */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.main-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; }
main { padding: 1rem; padding-bottom: calc(var(--nav-h) + 1.5rem + env(safe-area-inset-bottom)); width: 100%; max-width: 1100px; margin: 0 auto; outline: none; }
main.narrow { max-width: 760px; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .75rem; padding: calc(.5rem + env(safe-area-inset-top)) 1rem .5rem; background: var(--navy); color: #fff; }
.topbar .boat-select { flex: 1; } .topbar select { width: 100%; max-width: 320px; font-weight: 600; }
.topbar .icon-btn { color: #fff; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; text-decoration: none; color: inherit; }
.nav { position: fixed; z-index: 30; bottom: 0; left: 0; right: 0; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.nav .brand, .nav .desk-only { display: none; }
.nav .brand { flex: none; }
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: var(--nav-h); gap: 2px; text-decoration: none; color: var(--muted); font-size: 1.25rem; }
.nav a em, .nav-more em { font-style: normal; font-size: .68rem; } .nav a.on, .nav-more.on { color: var(--primary); font-weight: 700; }
.nav-more { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: var(--nav-h); gap: 2px; background: none; border: 0; color: var(--muted); font: inherit; font-size: 1.25rem; cursor: pointer; }
.more-list { display: grid; gap: .35rem; }
.more-list a { display: flex; align-items: center; gap: .85rem; min-height: 48px; padding: 0 .85rem; border-radius: 10px; background: var(--bg); color: var(--text); text-decoration: none; font-weight: 600; }
.more-list a span { font-size: 1.25rem; } .more-list a.on { color: var(--primary); outline: 2px solid var(--primary); }
@media (min-width: 900px) {
  .app { flex-direction: row; }
  .nav { position: sticky; top: 0; height: 100dvh; width: var(--side-w); flex-direction: column; justify-content: flex-start; border-top: 0; border-right: 1px solid var(--line); padding: 1rem .75rem; gap: .25rem; }
  .nav .brand { display: flex; padding: .25rem .5rem 1rem; color: var(--text); font-size: 1.1rem; }
  .nav a:not(.brand) { flex: none; flex-direction: row; justify-content: flex-start; min-height: 44px; padding: 0 .75rem; border-radius: 10px; font-size: 1.1rem; gap: .75rem; }
  .nav a em { font-size: .95rem; } .nav a.on { background: color-mix(in srgb, var(--primary) 12%, transparent); }
  .nav .desk-only { display: flex; } .mobile-only { display: none !important; }
  .topbar { justify-content: flex-end; background: transparent; color: var(--text); border-bottom: 1px solid var(--line); }
  .topbar .boat-select { flex: none; }
  main { padding: 1.5rem 2rem 3rem; }
}

/* ───── Components ───── */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin: .25rem 0 1rem; }
.page-head.sub { margin-top: 1.5rem; align-items: center; } .page-head.sub h2 { margin: 0; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card.empty { text-align: center; padding: 2rem 1rem; }
.card.link { display: block; text-decoration: none; color: inherit; } .card.link:hover { border-color: var(--primary); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; }
.card.tip { border-left: 5px solid var(--amber); }
.card.boat.active { border-color: var(--teal); }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.cols { display: grid; gap: 1rem; grid-template-columns: 1fr; } @media (min-width: 800px) { .cols { grid-template-columns: 1fr 1fr; } }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-height: 44px; padding: 0 1rem; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.small { min-height: 36px; padding: 0 .7rem; font-size: .85rem; } .btn.block { width: 100%; }
.btn.primary { background: var(--primary); color: var(--primary-text); border-color: transparent; }
.btn.danger { background: var(--red); color: #fff; border-color: transparent; } .btn.ghost { background: transparent; border-color: transparent; }
.btn:disabled { opacity: .55; cursor: wait; } .btn:focus-visible, .icon-btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid color-mix(in srgb, var(--teal) 70%, transparent); outline-offset: 1px; }
.icon-btn { width: 44px; height: 44px; border: 0; background: transparent; color: inherit; font-size: 1.1rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.icon-btn.small { width: 28px; height: 28px; font-size: .85rem; }
.back { display: inline-block; margin-bottom: .5rem; text-decoration: none; }
input, select, textarea { font: inherit; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .7rem; min-height: 44px; width: 100%; }
textarea { min-height: 70px; resize: vertical; }
label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; font-weight: 600; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 500; color: var(--text); font-size: .95rem; min-height: 36px; }
label.check input { width: 20px; min-height: 20px; height: 20px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 1rem 0 0; padding: .75rem; } legend { font-size: .85rem; font-weight: 700; padding: 0 .4rem; color: var(--muted); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.form-grid { display: grid; gap: .75rem; grid-template-columns: 1fr; } .form-grid .span2 { grid-column: 1 / -1; }
@media (min-width: 560px) { .form-grid { grid-template-columns: 1fr 1fr; } }
.toolbar { display: flex; gap: .5rem; margin-bottom: 1rem; } .toolbar input { flex: 1; } .toolbar select { width: auto; }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: .75rem; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: .6rem .9rem; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; min-height: 44px; }
.tabs button.on { color: var(--primary); border-color: var(--teal); }
.chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .5rem; margin-bottom: .5rem; scrollbar-width: thin; }
.chip { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--line); color: var(--text); white-space: nowrap; }
.btn-chip { border: 0; cursor: pointer; min-height: 34px; font: inherit; font-size: .85rem; font-weight: 600; } .btn-chip.on { background: var(--primary); color: var(--primary-text); }
.chip.overdue { background: color-mix(in srgb, var(--red) 18%, transparent); color: var(--red); }
.chip.soon { background: color-mix(in srgb, var(--amber) 25%, transparent); color: #b5651d; }
.chip.ok { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }
.badge { background: var(--red); color: #fff; border-radius: 999px; padding: 0 .4rem; font-size: .72rem; }

.list { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1rem; }
.item { display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; text-decoration: none; color: inherit; }
.item.overdue { border-left-color: var(--red); } .item.soon { border-left-color: var(--amber); } .item.ok { border-left-color: var(--green); }
a.item:hover { border-color: var(--primary); }
.item-main { flex: 1 1 220px; min-width: 0; } .item-main input { margin-bottom: .25rem; }
.item-title { font-weight: 700; } .item-side { display: flex; flex-direction: column; align-items: flex-end; gap: .4rem; }
.amount { font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 559px) { .item-side { align-items: flex-start; width: 100%; } }
.list.tight .item { border-left-width: 1px; }
.mini { display: flex; justify-content: space-between; gap: .5rem; padding: .55rem 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; align-items: center; } .mini:first-of-type { border-top: 0; }

.stats, .stat-row { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); margin-bottom: 1rem; }
.stat-row { display: flex; gap: 2rem; flex-wrap: wrap; margin: 0 0 .5rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem .9rem; text-decoration: none; color: inherit; display: block; }
.stat span { display: block; font-size: .78rem; color: var(--muted); font-weight: 600; } .stat b { font-size: 1.35rem; }
.stat.bad b { color: var(--red); } .stat.warn b { color: #c47a2c; } .big { font-size: 1.5rem; font-weight: 700; }
.bars { display: grid; gap: .35rem; margin-top: .75rem; }
.bar { position: relative; display: flex; justify-content: space-between; padding: .3rem .5rem; border-radius: 6px; overflow: hidden; font-size: .85rem; }
.bar i { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--teal) 28%, transparent); z-index: 0; } .bar span, .bar b { position: relative; z-index: 1; }
.thumb { width: 56px; height: 56px; border-radius: 10px; overflow: hidden; background: var(--line); display: flex; align-items: center; justify-content: center; text-decoration: none; font-weight: 700; color: var(--muted); flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
button.thumb { border: 0; padding: 0; cursor: pointer; font: inherit; }
.receipt-view { background: var(--line); border-radius: 10px; overflow: hidden; margin-bottom: .6rem; display: flex; justify-content: center; }
.receipt-view img { max-width: 100%; max-height: 65dvh; object-fit: contain; display: block; }
.receipt-view iframe { width: 100%; height: 65dvh; border: 0; background: #fff; }
.map { height: 340px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); margin-bottom: 1rem; background: #cfe6ee; position: relative; z-index: 0; }
@media (min-width: 900px) { .map { height: 440px; } }
.track-svg { width: 100%; height: 100%; display: block; background: #dcedf3; }
.gallery { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.gallery figure { margin: 0; } .gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block; }
.gallery figcaption { font-size: .72rem; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.photo-pick { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.pick { position: relative; cursor: pointer; border-radius: 10px; overflow: hidden; border: 2px solid transparent; } .pick.in { border-color: var(--teal); }
.pick img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; } .pick span { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, .55); color: #fff; font-size: .68rem; padding: 2px 6px; }
.pick input { position: absolute; top: 6px; left: 6px; width: 22px; height: 22px; min-height: 0; z-index: 1; }
.article { max-width: 720px; } .article .lead { font-size: 1.1rem; color: var(--muted); } .article li { margin-bottom: .5rem; }
h2.cat { margin-top: 1.5rem; }
.auth { max-width: 380px; margin: 8vh auto; text-align: center; } .auth form { display: grid; gap: .75rem; text-align: left; margin: 1rem 0; }

/* ───── Modal & toast ───── */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(520px, calc(100vw - 1.5rem)); max-height: calc(100dvh - 2rem); background: var(--card); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
dialog.wide { width: min(720px, calc(100vw - 1.5rem)); } dialog::backdrop { background: rgba(5, 20, 30, .55); }
.modal-form { display: flex; flex-direction: column; max-height: calc(100dvh - 2rem); }
.modal-form header { display: flex; justify-content: space-between; align-items: center; padding: .6rem .6rem .6rem 1.1rem; border-bottom: 1px solid var(--line); } .modal-form h2 { margin: 0; }
.modal-body { padding: 1rem 1.1rem; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-form footer { display: flex; justify-content: flex-end; gap: .5rem; padding: .75rem 1.1rem calc(.75rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
@media (max-width: 560px) { dialog, dialog.wide { width: 100vw; max-width: 100vw; max-height: 94dvh; margin: auto 0 0; border-radius: 16px 16px 0 0; } .modal-form { max-height: 94dvh; } }
#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--navy); color: #fff; padding: .7rem 1.1rem; border-radius: 12px; opacity: 0; pointer-events: none; transition: .25s; z-index: 100; max-width: min(92vw, 460px); white-space: pre-line; font-weight: 600; }
#toast.show { opacity: 1; transform: translate(-50%, 0); } #toast.error { background: var(--red); } #toast.ok { background: var(--green); }
@media (min-width: 900px) { #toast { bottom: 24px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print { .nav, .topbar, .btn, .row { display: none !important; } body { background: #fff; color: #000; } }
.lang-sel { width: auto; min-width: 180px; }
.readonly [data-act]:not([data-keep]) { display: none !important; }
.banner { background: color-mix(in srgb, var(--amber) 22%, transparent); border: 1px solid var(--amber); border-radius: 10px; padding: .5rem .8rem; margin-bottom: 1rem; font-weight: 600; font-size: .9rem; }
.providers { display: grid; gap: .5rem; margin: 1rem 0; } .or { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-size: .8rem; }
.or::before, .or::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.linkbox { display: flex; gap: .4rem; align-items: center; margin-top: .75rem; flex-wrap: wrap; } .linkbox input { flex: 1 1 200px; font-size: .8rem; }
.blame { margin-top: .2rem; } .link-btn { background: none; border: 0; cursor: pointer; font-size: .9rem; padding: 0 .3rem; min-height: 28px; }
.acts { list-style: none; margin: 0 0 .75rem; padding: 0; } .act { padding: .6rem 0; border-top: 1px solid var(--line); } .act:first-child { border-top: 0; }
.diff { margin: .2rem 0 .1rem 1rem; padding: 0; } .diff s { color: var(--muted); }
.tbl-wrap { overflow-x: auto; margin-top: .5rem; } .tbl { border-collapse: collapse; width: 100%; } .tbl th, .tbl td { text-align: left; padding: .25rem .5rem; border-bottom: 1px solid var(--line); white-space: nowrap; } .tbl th { color: var(--muted); font-weight: 600; }
.imp-ds { margin: .75rem 0; border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; } .imp-ds .form-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
[hidden] { display: none !important; }
fieldset { min-width: 0; } .imp-ds .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } @media (min-width: 700px) { .imp-ds .form-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } }
.imp-ds select { width: 100%; min-width: 0; }
.notice { background: color-mix(in srgb, var(--teal, #2ec4b6) 14%, transparent); border: 1px solid color-mix(in srgb, var(--teal, #2ec4b6) 45%, transparent); border-radius: 10px; padding: .55rem .8rem; margin: 0 0 1rem; font-size: .9rem; }
.boat-thumb { width: 56px; height: 56px; border-radius: 14px; object-fit: cover; flex: none; } .head-id { display: flex; gap: .8rem; align-items: center; }
.boat-card-photo { width: 100%; height: 150px; object-fit: cover; border-radius: 10px; margin-bottom: .6rem; }
.profile { display: grid; gap: 1rem; } .boat-photo { width: 100%; max-height: 260px; object-fit: cover; border-radius: 12px; } @media (min-width: 800px) { .profile:has(.boat-photo) { grid-template-columns: 280px 1fr; } .boat-photo { height: 100%; max-height: none; } }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem 1rem; margin: .5rem 0 0; } .facts dt { color: var(--muted); font-size: .78rem; } .facts dd { margin: 0; font-weight: 600; word-break: break-word; }
details.sec { border: 1px solid var(--line); border-radius: 10px; padding: .4rem .8rem; margin: .6rem 0; } details.sec > summary { cursor: pointer; font-weight: 600; padding: .3rem 0; } details.sec[open] > summary { margin-bottom: .5rem; }
.docs { list-style: none; margin: 0 0 .8rem; padding: 0; } .doc { display: flex; gap: .5rem; align-items: center; padding: .4rem 0; border-top: 1px solid var(--line); flex-wrap: wrap; } .doc:first-child { border-top: 0; } .doc-open { text-align: left; font-weight: 600; text-decoration: underline; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.cat-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-top: 1.2rem; } .cat-head h3 { margin: 0; }

/* Vipps sign-in: brand orange. Swap in the official button from Vipps MobilePay's brand guidelines if you want the logo. */
.btn.vipps{background:#ff5b24;border-color:#ff5b24;color:#fff;font-weight:700}
.btn.vipps:hover{background:#e84e1a;border-color:#e84e1a}

/* Subscription + your data */
.meter { margin: .5rem 0 .8rem; } .meter-row { display: flex; justify-content: space-between; font-size: .88rem; margin-bottom: .25rem; }
.mbar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; } .mbar i { display: block; height: 100%; background: var(--teal); border-radius: 99px; transition: width .3s; }
.mbar.warn i { background: var(--amber); } .mbar.full i { background: var(--red); }
.notice.warn { background: color-mix(in srgb, var(--amber) 20%, transparent); border-color: var(--amber); }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .6rem; margin: .8rem 0; }
.plan { display: flex; flex-direction: row; align-items: center; gap: .6rem; border: 1px solid var(--line); border-radius: 12px; padding: .7rem .8rem; cursor: pointer; font-weight: 500; color: var(--text); min-height: 48px; }
.plan:has(input:checked) { border-color: var(--teal); background: color-mix(in srgb, var(--teal) 10%, transparent); }
.plan input { width: 20px; min-height: 20px; height: 20px; } .plan em { color: var(--green); font-style: normal; font-size: .8rem; }
.fmt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .6rem; margin: .8rem 0; }
.btn.fmt { display: grid; grid-template-columns: 2.2rem 1fr; text-align: left; align-items: center; gap: .1rem .5rem; padding: .6rem .8rem; height: auto; white-space: normal; }
.btn.fmt .fmt-ic { grid-row: span 2; font-size: 1.5rem; text-align: center; } .btn.fmt small { font-weight: 400; color: var(--muted); line-height: 1.25; }
.row-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .4rem; }

/* Regatta glossary + courses */
abbr.ab { text-decoration: underline dotted; text-underline-offset: 2px; cursor: help; }
.glossary { margin: 0 0 .75rem; } .glossary dt { margin-top: .6rem; } .glossary dd { margin: .1rem 0 0; color: var(--muted); }
.glossary dt.gl-focus { background: color-mix(in srgb, var(--teal) 22%, transparent); border-radius: 6px; padding: 0 .3rem; }
.gl-search { width: 100%; margin-bottom: .5rem; }
.course { border-top: 1px solid var(--line); padding-top: .75rem; margin-top: .75rem; }
.course:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.course-grid { display: grid; gap: .75rem; grid-template-columns: 1fr; } @media (min-width: 800px) { .course-grid.two { grid-template-columns: 1fr 1fr; } }
.course-fig { margin: 0; } .course-fig img { width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); display: block; cursor: zoom-in; background: #fff; }
.course-form .course-fig img { max-height: 220px; object-fit: contain; width: auto; max-width: 100%; }
.course-fig figcaption { font-size: .8rem; color: var(--muted); margin-top: .2rem; }
.course-svg { color: var(--text); }
.course-preview { min-height: 3rem; } .course-errors { color: var(--red); font-size: .85rem; margin: .25rem 0; }
.course textarea, .course-form textarea { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }

/* ⋯ menu (details/summary: works without JS, closes on outside click via app.js) */
details.menu { position: relative; }
details.menu > summary { list-style: none; cursor: pointer; font-size: 1.1rem; line-height: 1; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 11rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .15); padding: .3rem; display: grid; }
.menu-pop > a, .menu-pop > button { display: flex; align-items: center; gap: .5rem; min-height: 40px; padding: 0 .7rem; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.menu-pop > a:hover, .menu-pop > button:hover, .menu-pop > :focus-visible { background: var(--bg); }
.menu-pop > .danger-text { color: var(--red); }
/* key figures on phones: two per row; an odd last one spans the row instead of sitting alone */
@media (max-width: 559px) { .stats { grid-template-columns: 1fr 1fr; } .stats > :last-child:nth-child(odd) { grid-column: 1 / -1; } }
@media (max-width: 559px) { .menu-pop { left: 0; right: auto; } }

/* Offline: status chip in the top bar, "new version" bar */
.net-status { font-size: .8rem; font-weight: 600; padding: .25rem .6rem; border-radius: 999px; background: color-mix(in srgb, var(--amber) 25%, transparent); color: inherit; white-space: nowrap; }
.net-status.off { background: var(--amber); color: #2b1600; }
.update-bar { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); display: flex; gap: .75rem; align-items: center; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: .6rem .6rem .6rem 1rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); width: max-content; max-width: calc(100vw - 1.5rem); }
@media (min-width: 900px) { .update-bar { bottom: 24px; } }

/* Line icons (js/icons.js) */
.ico { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.25em; }
.nav .ico { width: 24px; height: 24px; } .more-list .ico { width: 22px; height: 22px; color: var(--primary); }
.icon-btn .ico { width: 22px; height: 22px; }

/* ───────────── Dashboard: hero, stat tiles, charts, get-started ───────────── */
:root { --chart: #0f7fa3; --tone-bad: #fbe9ec; --tone-warn: #fdf1e3; --tone-good: #e3f4f1; --tone-n: #e8f1f5; }
@media (prefers-color-scheme: dark) { :root { --chart: #26a89b; --tone-bad: #3a1f27; --tone-warn: #3a2c1c; --tone-good: #15352f; --tone-n: #1c3540; } }
body, .stat b, .mini b, td, .chip { font-variant-numeric: tabular-nums; }
h1, h2, h3 { letter-spacing: -.01em; text-wrap: balance; }

.hero { position: relative; overflow: hidden; border-radius: calc(var(--radius) + 4px); min-height: 170px; margin-bottom: 1rem; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, #1b8fae 0%, transparent 55%), linear-gradient(135deg, #0b3954 0%, #0f5f7d 60%, #127a8f 100%); display: flex; }
.hero.photo-on { min-height: 220px; }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero.photo-on::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(6, 24, 34, .05) 20%, rgba(6, 24, 34, .78) 100%); }
.hero-mark { position: absolute; right: -10px; bottom: -18px; width: 190px; height: 190px; fill: none; stroke: rgba(255, 255, 255, .13); stroke-width: 1.2; stroke-linejoin: round; stroke-linecap: round; }
.hero-body { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: .8rem 1rem; align-items: flex-end; justify-content: space-between; width: 100%; padding: 1.1rem 1.2rem; margin-top: auto; }
.hero h1 { margin: 0; font-size: clamp(1.6rem, 4.5vw, 2.3rem); line-height: 1.1; text-shadow: 0 1px 12px rgba(0, 0, 0, .25); }
.hero p { margin: .25rem 0 0; opacity: .88; }
.hero-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.btn.glass { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .3); color: #fff; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.btn.glass:hover { background: rgba(255, 255, 255, .26); }

.stat { position: relative; transition: transform .12s, box-shadow .12s; }
a.stat:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(11, 57, 84, .1); }
.stat-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--tone-n); color: var(--chart); font-style: normal; margin-bottom: .45rem; }
.stat-ico .ico { width: 19px; height: 19px; }
.stat b { display: block; font-size: 1.35rem; line-height: 1.2; overflow-wrap: break-word; } .stat b.long { font-size: 1.08rem; }
.stat b small { font-size: .7em; font-weight: 600; color: var(--muted); }
.stat.bad { background: var(--tone-bad); border-color: transparent; } .stat.bad .stat-ico { background: var(--red); color: #fff; }
.stat.warn { background: var(--tone-warn); border-color: transparent; } .stat.warn .stat-ico { background: #c47a2c; color: #fff; }
.stat.good .stat-ico { background: var(--tone-good); color: var(--green); }

.onboard { display: flex; gap: .9rem; align-items: center; flex-wrap: wrap; border-color: color-mix(in srgb, var(--chart) 40%, var(--line)); background: color-mix(in srgb, var(--chart) 7%, var(--card)); }
.onboard > div { flex: 1 1 16rem; } .onboard h2 { margin: 0 0 .15rem; font-size: 1.1rem; } .onboard p { margin: 0; }
.onboard .stat-ico { width: 44px; height: 44px; }

figure.chart { margin: 0; }
.chart figcaption { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; flex-wrap: wrap; margin-bottom: .4rem; }
.chart h3 { margin: 0; font-size: 1rem; } .chart figcaption p { margin: 0; font-size: .85rem; }
.ch-wrap { position: relative; }
.ch-plot { height: 190px; } .ch-plot svg { display: block; overflow: visible; }
.ch-grid { stroke: var(--line); stroke-width: 1; } .ch-grid.base { stroke: var(--muted); stroke-opacity: .5; }
.ch-axis { fill: var(--muted); font-size: 11px; }
.ch-bar { fill: var(--chart); transition: opacity .12s; }
.ch-hit { fill: transparent; }
.ch-col { outline: none; cursor: default; }
.ch-col.on .ch-hit { fill: var(--text); fill-opacity: .05; }
.ch-col:focus-visible .ch-hit { stroke: var(--chart); stroke-width: 2; }
.ch-tip { position: absolute; top: -6px; transform: translate(-50%, -100%); pointer-events: none; background: var(--text); color: var(--card); border-radius: 8px; padding: .3rem .55rem; font-size: .8rem; white-space: nowrap; display: grid; text-align: center; box-shadow: 0 6px 16px rgba(0, 0, 0, .18); }
.ch-tip small { opacity: .75; }
.ch-table { margin-top: .3rem; font-size: .85rem; } .ch-table summary { cursor: pointer; color: var(--muted); }
.ch-table table { width: 100%; border-collapse: collapse; margin-top: .3rem; } .ch-table th, .ch-table td { padding: .2rem .3rem; border-bottom: 1px solid var(--line); text-align: left; font-weight: 400; } .ch-table td { text-align: right; }

.wiz-list { display: grid; gap: .5rem; margin: .6rem 0 1rem; }
.wiz-row { display: flex; gap: .6rem 1rem; justify-content: space-between; align-items: center; flex-wrap: wrap; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 12px; }
.wiz-row > div:first-child { display: grid; flex: 1 1 12rem; } .wiz-row small { font-size: .8rem; }
.wiz-in { display: flex; gap: .5rem; flex: 1 1 14rem; } .wiz-in label { flex: 1; font-size: .78rem; } .wiz-in input { min-height: 40px; padding: .4rem .5rem; }

/* ───────────── Regatta course on the chart (js/seamap.js) ───────────── */
.course-map { height: 360px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #aad3df; z-index: 0; }
.course-map.no-map { height: auto; background: none; border: 0; }
.course-form .course-map { height: 300px; margin-bottom: .4rem; }
@media (max-width: 559px) { .course-map { height: 300px; } }
.cm-pin { display: inline-flex; align-items: center; gap: .25rem; transform: translateY(0); white-space: nowrap; font: 700 12px/1 system-ui, sans-serif; color: #fff; padding: 4px 8px 4px 4px; border-radius: 999px; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); border: 2px solid #fff; position: relative; }
.cm-pin::after { content: ''; position: absolute; left: 12px; bottom: -9px; border: 6px solid transparent; border-top-color: #fff; }
.cm-pin svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cm-pin.start { background: #1f8a4c; } .cm-pin.start svg path:last-child { fill: #fff; }
.cm-pin.finish { background: #14262f; } .cm-pin.finish svg { stroke: #fff; }
.cm-pin.both { background: linear-gradient(90deg, #1f8a4c 0 50%, #14262f 50% 100%); } .cm-pin.both svg path:last-child { fill: #fff; }
.cm-buoy { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 700 12px/1 system-ui, sans-serif; background: #f4b400; color: #14262f; border: 3px solid #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, .35); }
.cm-buoy.port { border-color: #d1495b; } .cm-buoy.starboard { border-color: #1f8a4c; }
.cm-arrow { width: 18px; height: 18px; display: grid; place-items: center; }
.cm-arrow svg { width: 18px; height: 18px; fill: none; stroke: #0b3954; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 1.5px #fff) drop-shadow(0 0 1.5px #fff); }
.cm-legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin: .4rem 0 0; }
.cm-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.cm-key { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.cm-key.start { background: #1f8a4c; } .cm-key.finish { background: #14262f; outline: 1px solid var(--muted); }
.cm-key.port { background: #f4b400; box-shadow: 0 0 0 3px #d1495b; } .cm-key.starboard { background: #f4b400; box-shadow: 0 0 0 3px #1f8a4c; }

.cm-fixed { display: inline-flex; align-items: center; gap: 3px; cursor: pointer; white-space: nowrap; font: 600 11px/1 system-ui, sans-serif; color: #14262f; }
.cm-fixed b { display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 4px; border-radius: 11px; background: #fff; border: 2px solid #5d7380; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); }
.cm-fixed span { background: rgba(255, 255, 255, .85); padding: 2px 4px; border-radius: 4px; }
.cm-fixed:hover b { border-color: #0b3954; background: #e8f1f5; }
.cm-fixed.used b { visibility: hidden; } /* the route's own marker sits on top; the name stays clickable */
.cm-fixed.used span { margin-left: 8px; }
.course-form .course-map { cursor: default; }

/* ───────────── Course editor: wide dialog, full screen, start/finish line pick modes ───────────── */
dialog.course-dlg { width: min(1180px, calc(100vw - 1.5rem)); }
@media (min-width: 900px) {
  .course-dlg .course-form { display: grid; grid-template-columns: minmax(320px, 420px) 1fr; gap: 1.1rem; align-items: start; }
  .course-dlg .cf-main { position: sticky; top: 0; }
  .course-dlg .course-form .course-map { height: min(62dvh, 620px); margin: 0; }
}
dialog.course-dlg.full { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
dialog.course-dlg.full { overflow: hidden; }
dialog.course-dlg.full .modal-form { height: 100%; max-height: 100%; }
dialog.course-dlg.full .modal-body { flex: 1; padding: .75rem; }
@media (min-width: 900px) {
  dialog.course-dlg.full .modal-body { overflow: hidden; display: flex; }
  dialog.course-dlg.full .course-form { flex: 1; height: 100%; grid-template-columns: minmax(320px, 400px) 1fr; }
  dialog.course-dlg.full .cf-side { height: 100%; overflow-y: auto; padding-right: .3rem; }
  dialog.course-dlg.full .cf-main, dialog.course-dlg.full .course-form .course-map { height: 100%; }
}
@media (max-width: 899px) {
  dialog.course-dlg.full .course-form { display: flex; flex-direction: column; }
  dialog.course-dlg.full .cf-main { order: -1; position: sticky; top: -.75rem; z-index: 2; background: var(--card); padding-bottom: .5rem; }
  dialog.course-dlg.full .course-form .course-map { height: 55dvh; }
}
.seg { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin: .2rem 0 .6rem; }
.seg label { display: inline-flex; flex-direction: row; font-size: .85rem; color: var(--text); font-weight: 600; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { padding: .35rem .7rem; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; background: var(--card); }
.seg input:checked + span { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.seg input:focus-visible + span { outline: 2px solid var(--chart); outline-offset: 2px; }
.seg > .muted { width: 100%; }
.cm-key.line { width: 18px; height: 5px; border-radius: 0; background: repeating-linear-gradient(90deg, #1f8a4c 0 6px, transparent 6px 9px); }

/* ───────────── Regatta accounts, club library, race screen ───────────── */
.contents { display: contents; } .contents[hidden] { display: none; }
.mode-chip { margin-left: .35rem; padding: 1px 8px; border-radius: 999px; background: var(--teal); color: #062029; font-size: .7rem; font-weight: 700; vertical-align: middle; }
.acct-type { border: 1px solid var(--line); border-radius: 10px; padding: .5rem .75rem; margin: .5rem 0; display: grid; gap: .35rem; }
.acct-type label { flex-direction: row; align-items: flex-start; gap: .5rem; margin: 0; font-weight: 500; }
.checks-box { border: 1px solid var(--line); border-radius: 10px; padding: .5rem .75rem; display: grid; gap: .3rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.checks-box legend { padding: 0 .3rem; font-weight: 600; }
.cls-row { display: grid; grid-template-columns: 1.4fr 1fr 1.2fr auto; gap: .4rem; align-items: center; margin-bottom: .4rem; }
@media (max-width: 560px) { .cls-row { grid-template-columns: 1fr 1fr; } }
.live-card { border: 2px solid var(--amber); }
.big-btn { min-height: 52px; font-size: 1.05rem; font-weight: 700; }
a.btn.block { display: flex; justify-content: center; margin: .35rem 0; }

.race-screen { max-width: 640px; margin: 0 auto; display: grid; gap: .9rem; }
.race-head h1 { margin: .2rem 0; font-size: 1.4rem; }
.race-head .back { text-decoration: none; font-weight: 600; }
.race-big { width: 100%; min-height: 44vh; border: 0; border-radius: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem;
  background: var(--navy); color: #fff; font: inherit; cursor: pointer; box-shadow: var(--shadow); -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.race-big .rb-label { font-size: 1.4rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.race-big .rb-time { font-size: clamp(4rem, 22vw, 9rem); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.race-big .rb-sub { font-size: 1rem; opacity: .85; }
.race-big[data-mode="race"] { background: var(--green); }
.race-big[data-mode="done"] { background: #14262f; }
.race-big.flash { animation: race-flash .5s steps(1) infinite; }
@keyframes race-flash { 0% { background: var(--red); color: #fff; } 50% { background: #ffd23f; color: #14262f; } }
@media (prefers-reduced-motion: reduce) { .race-big.flash { animation: none; background: var(--red); outline: 6px solid #ffd23f; outline-offset: -6px; } }
.race-signals { display: flex; gap: .4rem; justify-content: center; flex-wrap: wrap; }
.race-signals span { padding: .25rem .7rem; border-radius: 999px; border: 2px solid var(--line); color: var(--muted); font-weight: 700; font-size: .9rem; }
.race-signals span.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.race-finish { width: 100%; min-height: 110px; border: 0; border-radius: 22px; background: #14262f; color: #fff; font: inherit; font-size: 2rem; font-weight: 800; cursor: pointer;
  background-image: repeating-conic-gradient(rgba(255,255,255,.08) 0 25%, transparent 0 50%); background-size: 36px 36px; touch-action: manipulation; }
.race-finish:active { transform: scale(.98); }
.race-undo { border: 2px solid var(--amber); }
.rg-marks { margin: .4rem 0 0; padding-left: 1.4rem; display: grid; gap: .3rem; }
.rg-marks li { display: list-item; }
.rg-marks li > span:first-child { font-weight: 600; } .rg-marks li > span + span { float: right; }
.rg-marks li.done { color: var(--muted); } .rg-marks li.done > span:first-child { text-decoration: line-through; }
.rg-marks li.next > span:first-child { color: var(--primary); }
@media (prefers-color-scheme: dark) { .race-big[data-mode="wait"], .race-big[data-mode="count"] { background: #0b3954; } .race-signals span.on { background: var(--teal); border-color: var(--teal); color: #062029; } }
/* Time limit */
.race-limit { display: flex; flex-wrap: wrap; gap: .3rem .6rem; justify-content: center; align-items: baseline; text-align: center; padding: .6rem .9rem; border-radius: 14px; background: var(--card); border: 2px solid var(--line); font-size: 1.05rem; }
.race-limit > span.muted { flex-basis: 100%; }
.race-limit.out { background: var(--red); border-color: var(--red); color: #fff; flex-direction: column; align-items: center; font-size: 1.15rem; }
.limit-alert { margin-top: .35rem; padding: .5rem .7rem; border-radius: 10px; background: color-mix(in srgb, var(--red) 12%, var(--card)); border: 1px solid var(--red); display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.limit-box { border: 1px solid var(--line); border-radius: 10px; padding: .5rem .75rem; margin-top: .5rem; }
.limit-box legend { padding: 0 .3rem; font-weight: 600; }
/* Race map and recap */
.race-big.compact { min-height: 0; padding: .7rem 1rem; flex-direction: row; flex-wrap: wrap; gap: .2rem .8rem; }
.race-big.compact .rb-time { font-size: clamp(2.4rem, 11vw, 3.6rem); }
.race-big.compact .rb-label { font-size: 1rem; } .race-big.compact .rb-sub { flex-basis: 100%; font-size: .85rem; }
.race-map, .recap-map { height: 52vh; min-height: 300px; border-radius: 12px; overflow: hidden; margin-top: .5rem; background: #aad3df; }
.recap-map { height: 60vh; }
.race-map-card .row h3 { margin: 0; }
.rm-boat { position: relative; width: 22px; height: 22px; }
.rm-boat i { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 50%; background: var(--c); border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.rm-boat i svg { width: 14px; height: 14px; fill: #fff; stroke: none; }
.rm-boat span { position: absolute; left: 24px; top: 1px; white-space: nowrap; font: 700 11px/1.5 system-ui, sans-serif; color: #14262f; background: rgba(255,255,255,.9); border-radius: 4px; padding: 0 4px; border-left: 3px solid var(--c); }
.rm-boat.me i { width: 28px; height: 28px; inset: -3px; border-width: 3px; box-shadow: 0 0 0 3px var(--c), 0 1px 4px rgba(0,0,0,.5); }
.rm-boat.stale i { opacity: .45; } .rm-boat.stale span { opacity: .6; font-style: italic; }
.rm-boat.dim { opacity: .3; }
.recap-controls { display: flex; gap: .6rem; align-items: center; margin-top: .6rem; }
.recap-controls input[type=range] { flex: 1; min-height: 32px; accent-color: var(--primary); }
.recap-controls select { width: auto; }
.recap-controls .btn { min-width: 52px; font-size: 1.1rem; }
.recap-time { margin: .3rem 0 0; font-variant-numeric: tabular-nums; }
.recap-list { margin: .3rem 0; padding-left: 1.6rem; display: grid; gap: .25rem; }
.recap-boat { width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: .1rem .45rem; text-align: left; background: none; border: 1px solid transparent; border-radius: 8px; padding: .35rem .5rem; font: inherit; color: inherit; cursor: pointer; }
.recap-boat:hover { background: var(--bg); } .recap-boat.on { border-color: var(--primary); background: var(--bg); }
.recap-boat .rc-prog { flex-basis: 100%; padding-left: 1.3rem; }
.rc-sw { display: inline-block; width: .85rem; height: .85rem; border-radius: 50%; background: var(--c); border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); vertical-align: -1px; margin-right: .3rem; }
/* Race banner on every page */
.race-banner-wrap { display: grid; gap: .5rem; margin-bottom: 1rem; }
.race-banner { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; border-radius: 14px; background: var(--navy); color: #fff; text-decoration: none; box-shadow: var(--shadow); }
.race-banner .rbn-flag { font-size: 1.6rem; }
.race-banner .rbn-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.race-banner .rbn-when { font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.race-banner .rbn-go { font-weight: 700; white-space: nowrap; }
.race-banner.soon { animation: race-flash 1s steps(1) infinite; }
@media (prefers-reduced-motion: reduce) { .race-banner.soon { animation: none; background: var(--red); } }
@media (max-width: 480px) { .race-banner .rbn-go { display: none; } }
.draft-warn { border: 2px solid var(--amber); }
