:root {
  --calendar: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235d7280' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E");
  --clock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235d7280' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%235d7280' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --bg: #f4f7f9;
  --surface: #ffffff;
  --surface-2: #eef3f6;
  --border: #dde5eb;
  --field-border: #8496a3; /* a field's edge: 3:1 against the card (WCAG 1.4.11), cards keep the soft --border */
  --text: #13232e;
  --muted: #5d7280;
  --accent: #0e7490;
  --accent-strong: #0b5d73;
  --accent-soft: #e0f2f6;
  --chart-neutral: #8a9ca8;
  --chart-second: #c2410c;
  --nx: #b45309;
  --nx-soft: #fdf1e3;
  --danger: #b42318;
  --ok-soft: #e7f6ee;
  --ok: #17663a;
  --err-soft: #fdecea;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 35, 46, .06), 0 1px 3px rgba(16, 35, 46, .05);
  color-scheme: light;
}
/* Dark: follows the device, unless the profile says light; data-theme="dark" (profile) always is */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --calendar: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238ea3ae' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E");
    --clock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238ea3ae' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238ea3ae' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    --bg: #0b1419;
    --surface: #111e25;
    --surface-2: #17262e;
    --border: #22343e;
    --field-border: #5c7684;
    --text: #e3edf2;
    --muted: #8ea3ae;
    --accent: #38b2cc;
    --accent-strong: #5cc6dc;
    --accent-soft: #123341;
    --chart-neutral: #566b78;
  --chart-second: #e0763a;
    --chart-second: #e0763a;
    --nx: #f0a94b;
    --nx-soft: #3a2a14;
    --danger: #f07167;
    --ok-soft: #12301f;
    --ok: #7dd3a0;
    --err-soft: #3a1714;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --calendar: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238ea3ae' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E");
  --clock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238ea3ae' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238ea3ae' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --bg: #0b1419;
  --surface: #111e25;
  --surface-2: #17262e;
  --border: #22343e;
  --field-border: #5c7684;
  --text: #e3edf2;
  --muted: #8ea3ae;
  --accent: #38b2cc;
  --accent-strong: #5cc6dc;
  --accent-soft: #123341;
  --chart-neutral: #566b78;
  --chart-second: #e0763a;
  --nx: #f0a94b;
  --nx-soft: #3a2a14;
  --danger: #f07167;
  --ok-soft: #12301f;
  --ok: #7dd3a0;
  --err-soft: #3a1714;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* beats display rules such as label { display: flex } */
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }  /* no double-tap zoom; pinch zoom stays (accessibility) */
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .9rem; }
h3 { font-size: .95rem; margin: 1.2rem 0 .5rem; }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 5px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
/* safe-area insets keep content clear of the notch and home indicator when installed on an iPhone home screen */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
main.wrap { padding-top: 24px; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }

/* top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; padding-top: env(safe-area-inset-top); }
.topbar-inner { display: flex; align-items: center; gap: 20px; min-height: 58px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.logo { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); position: relative; overflow: hidden; flex: none; }
.logo::after { content: ""; position: absolute; left: -4px; right: -4px; top: 11px; height: 6px; border-top: 2.5px solid #fff; border-radius: 50%; }
.logo.lg { width: 36px; height: 36px; }
.logo.lg::after { top: 16px; }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.nav a { color: var(--muted); padding: 8px 12px; border-radius: 8px; white-space: nowrap; font-weight: 500; }
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav a.active { color: var(--accent); background: var(--accent-soft); }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .72rem; line-height: 18px; text-align: center; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-right form { margin: 0; }
.linkbtn { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 4px; }
.linkbtn:hover { color: var(--text); }
@media (max-width: 720px) {
  .topbar-inner { gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  .topbar-right { margin-left: auto; }
}

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary { color: #06222b; } }
:root[data-theme="dark"] .btn-primary { color: #06222b; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
/* A button that waits on the server: a ring in the button's own text colour, in front of a label that stays as it is */
.btn-spinner { width: 14px; height: 14px; flex: none; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent; animation: spin .8s linear infinite; }
@media (prefers-reduced-motion: reduce) { .btn-spinner { display: none; } }
.btn-danger { color: var(--danger); }
.btn.btn-danger:not(.btn-ghost) { border-color: var(--danger); }
.btn.btn-danger:not(.btn-ghost):hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: .85rem; }
.btn-block { width: 100%; }
.row-gap { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row-gap form { margin: 0; }

/* layout */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .06em; font-size: .75rem; font-weight: 700; color: var(--accent); margin: 0 0 4px !important; }
.back { display: inline-block; margin-bottom: 12px; font-size: .9rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; }
.card-head > .row-gap { flex-wrap: nowrap; flex-shrink: 0; gap: 6px; } /* the buttons stay side by side; a long title wraps */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 { margin-bottom: 16px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }
.empty { text-align: center; padding: 40px 20px; }

/* flash */
.flash { padding: 10px 14px; border-radius: 9px; margin-bottom: 16px; background: var(--ok-soft); color: var(--ok); font-weight: 500; }
.flash-error { background: var(--err-soft); color: var(--danger); }
/* the plan's errors, above the form: focused on load, with the count as its heading */
#plan-errors { outline: none; }
#plan-errors:focus { outline: 2px solid var(--danger); outline-offset: 2px; }
#plan-errors h2 { margin: 0 0 6px; font-size: .95rem; font-weight: 600; color: inherit; }
#plan-errors ul { margin: 0; padding-left: 18px; font-weight: 400; }
/* the plan's summary, which takes the focus when the plan lands: the site's accent, not the browser's default ring */
#plan-result:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; box-shadow: var(--shadow); min-width: 0; }
.stat-label { color: var(--muted); font-size: .8rem; font-weight: 500; }
.stat-value { font-size: 1.45rem; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: .8rem; }

/* bars */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 64px 1fr 36px; align-items: center; gap: 10px; font-size: .88rem; }
.bar-label { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-track { height: 12px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 6px; min-width: 2px; }
.bar-value { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* dive list */
.dive-list { list-style: none; margin: 0; padding: 0; }
.dive-list li + li { border-top: 1px solid var(--border); }
.dive-item { display: flex; align-items: center; gap: 14px; padding: 12px 4px; color: var(--text); }
a.dive-item:hover { text-decoration: none; background: var(--surface-2); border-radius: 8px; }
.dive-item form { margin: 0; }
.dive-no { color: var(--muted); font-variant-numeric: tabular-nums; width: 38px; flex: none; font-size: .9rem; }
.dive-main { display: flex; flex-direction: column; flex: 1; min-width: 0; color: var(--text); }
.dive-main .muted { font-size: .85rem; }
.dive-meta { display: flex; gap: 12px; align-items: center; font-variant-numeric: tabular-nums; white-space: nowrap; }

.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--muted); margin: 0 4px 4px 0; }
.chip-nx { background: var(--nx-soft); color: var(--nx); }
.chip-user { background: var(--accent-soft); color: var(--accent); }

/* table */
.filters { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filters input[type=search] { flex: 1; min-width: 0; }
.table-card { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
@media (max-width: 640px) { .hide-sm { display: none; } }

/* forms */
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--field-border);
  border-radius: 9px; padding: 9px 11px; width: 100%;
  font-size: 16px; /* below 16px iOS Safari zooms in on focus */
}
input { text-overflow: ellipsis; } /* a long placeholder ends in … instead of mid-word */
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
select { width: auto; }
.fields select { width: 100%; }
/* Own look for dropdowns (iOS draws a grey bevelled box otherwise); the chevron colour follows the theme. */
select {
  -webkit-appearance: none; appearance: none; cursor: pointer; line-height: 1.3;
  padding-right: 36px; background-image: var(--chevron); background-repeat: no-repeat;
  background-position: right 12px center; background-size: 12px 8px;
}
select::-ms-expand { display: none; }
.select-sm { padding: 5px 30px 5px 10px; background-position: right 10px center; border-radius: 8px; }
label { display: flex; flex-direction: column; gap: 5px; font-weight: 500; font-size: .9rem; }
.form { display: flex; flex-direction: column; gap: 18px; }
.form .row-gap { margin-top: 4px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
legend { font-weight: 700; margin-bottom: 10px; font-size: 1rem; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
/* a field with its message beside the label (planner.html, forms.js): what's inside a label is the field's name */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { flex: 1; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
label.check input { width: auto; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
.self-end { align-self: end; padding-bottom: 10px; }
details.more summary { cursor: pointer; font-weight: 600; color: var(--accent); margin-bottom: 12px; }
details.more > :not(summary) + :not(summary) { margin-top: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; margin: 18px 0; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 180px; }
.drop { border: 2px dashed var(--border); border-radius: var(--radius); padding: 26px; text-align: center; cursor: pointer; font-weight: 400; background: var(--surface-2); }
.drop:hover { border-color: var(--accent); }
.drop input { border: 0; background: transparent; padding: 0; max-width: 360px; margin: 0 auto 8px; }

/* detail */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
.dl dt { color: var(--muted); font-size: .9rem; }
.dl dd { margin: 0; font-variant-numeric: tabular-nums; }
.notes { white-space: pre-wrap; margin: 0; }

/* people */
.people { list-style: none; padding: 0; margin: 0; }
.people li { display: flex; align-items: center; gap: 10px; padding: 9px 0; }
.people li + li { border-top: 1px solid var(--border); }
.people form { margin: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; flex: none; }
.avatar { object-fit: cover; }
.avatar.sm { width: 30px; height: 30px; font-size: .85rem; }
.avatar.xl { width: 96px; height: 96px; font-size: 2.2rem; }
.profile-link { display: flex; border-radius: 50%; outline-offset: 2px; }
.profile-link.active .avatar, .profile-link:hover .avatar { box-shadow: 0 0 0 2px var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.plain { padding-left: 18px; margin: 0 0 12px; }

/* switches: e-mail notifications */
.toggle-list { list-style: none; margin: 0 0 12px; padding: 0; }
.toggle-list li { border-top: 1px solid var(--border); }
.toggle-list li:first-child { border-top: 0; }
label.toggle { display: flex; flex-direction: row; align-items: center; gap: 14px; padding: 12px 0; cursor: pointer; font-weight: 400; }
label.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-switch { flex: none; width: 42px; height: 24px; border-radius: 12px; background: var(--border); position: relative; transition: background .15s; }
.toggle-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
label.toggle input:checked + .toggle-switch { background: var(--accent); }
label.toggle input:checked + .toggle-switch::after { transform: translateX(18px); }
label.toggle input:focus-visible + .toggle-switch { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

/* public front page */
main.home { padding-top: max(12px, env(safe-area-inset-top)); padding-bottom: 32px; }
.home-bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 0 12px; }
.home-bar .brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); }
.home-bar { flex-wrap: wrap; gap: 4px 8px; }
.home-bar .row-gap { flex-wrap: nowrap; gap: 2px; margin-left: auto; }
@media (max-width: 460px) { .home-bar .btn-ghost { padding-left: 8px; padding-right: 8px; } }
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 32px; align-items: center; padding: 32px 0 40px; }
.hero h1 { font-size: 2.4rem; letter-spacing: -.02em; margin-bottom: 12px; }
.hero-lead { font-size: 1.1rem; color: var(--muted); margin: 0 0 20px; max-width: 34em; }
.hero-card { margin: 0; }
.demo-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.demo-stats > div { background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; }
.demo-stats b { display: block; font-size: 1.3rem; white-space: nowrap; }
.demo-dives { list-style: none; margin: 0; padding: 0; }
.demo-dives li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.demo-dives li > span:first-child { display: flex; flex-direction: column; min-width: 0; }
.demo-dives .chip { white-space: nowrap; }
.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.feature { margin: 0; }
.feature h2 { margin-bottom: .4rem; }
.feature p { margin: 0; color: var(--muted); }
.home-cta { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.home-cta h2 { margin-bottom: .3rem; }
.home-cta p { margin: 0; max-width: 36em; }
.home-foot { padding: 8px 0 0; }
.site-foot { margin-top: 48px; text-align: center; }
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding: 16px 0 24px; gap: 20px; }
  .features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .hero h1 { font-size: 1.9rem; }
  .demo-stats b { font-size: 1.1rem; }
  .features { grid-template-columns: 1fr; }
}

/* privacy statement and terms */
/* The docs (/docs) */
.docs { max-width: 760px; line-height: 1.6; }
.docs-head { margin: 8px 0 16px; }
.docs-head p { margin: 0; }
.docs section { scroll-margin-top: 72px; }
.docs section h2 { margin-bottom: .4rem; }
.docs section p, .docs section ul { margin: 0 0 .6rem; }
.docs section > :last-child { margin-bottom: 0; }
.docs ul, .docs-toc ol { padding-left: 20px; }
.docs li { margin-bottom: 4px; }
.docs-toc h2 { margin-bottom: .3rem; }
.docs-toc ol { margin: 0; columns: 2; column-gap: 24px; }
@media (max-width: 560px) { .docs-toc ol { columns: 1; } }
/* Courses (app/courses.py): the attendance grid, a lesson's students, a student's lessons */
.att-grid-wrap { overflow-x: auto; margin: 0 -4px 12px; }
.att-grid { border-collapse: collapse; font-size: .9rem; min-width: 100%; }
.att-grid th, .att-grid td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: center; white-space: nowrap; }
.att-grid thead th { font-size: .78rem; color: var(--muted); font-weight: 600; }
.att-grid tbody th { text-align: left; font-weight: 500; white-space: normal; min-width: 150px; }
.att-grid tbody th .chip { margin-left: 4px; font-size: .72rem; }
.att { font-weight: 700; }
.att-present { color: var(--ok, #157f3b); }
.att-absent { color: var(--danger); }
.att-excused { color: var(--muted); }
.chip-warn { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.menu-form { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--border); margin: 0; min-width: 240px; }
.add-student { margin-top: 14px; }
.add-student > summary { list-style: none; display: inline-flex; }
.add-student > summary::-webkit-details-marker { display: none; }
.add-student[open] > summary { margin-bottom: 12px; }
.student-card .card-head { margin-bottom: 8px; }
.handover { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.handover p { margin: 0 0 4px; }
.handover-head { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.attendance { display: flex; flex-direction: row; gap: 6px; border: 0; padding: 0; margin: 0 0 4px; }
.attendance .seg { flex: 1 1 0; min-width: 0; display: block; margin: 0; }
.skill-checks { display: flex; flex-wrap: wrap; gap: 4px 18px; border: 0; padding: 0; margin: 6px 0 10px; }
.skill-checks .check { margin: 0; }
.template-lesson { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin: 0 0 12px; display: grid; gap: 10px; }
.template-lesson legend { font-weight: 600; padding: 0 6px; }
.agency-checks { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.agency-checks .check { margin: 0; }
.cert-fields { display: flex; flex-direction: column; gap: 18px; }
.cert-fields[hidden], .template-cert[hidden] { display: none; }
.template-cert { display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; }
.standard-lessons { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.skill-list { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.student-card > label { margin-top: 12px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 9px 10px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-weight: 500; }
.seg input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.sticky-save { position: sticky; bottom: 76px; padding: 8px 0; }
@media (min-width: 721px) { .sticky-save { bottom: 0; } }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 10px 0 10px 16px; border-left: 2px solid var(--border); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 15px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border); }
.timeline li.past::before { background: var(--accent); border-color: var(--accent); }
.timeline p { margin: 0 0 4px; }
.people li.makeup-row { flex-direction: column; align-items: stretch; }
/* Certification cards and documents (app/certifications.py, app/documents.py) */
.people.cert-cards li { flex-direction: column; align-items: stretch; }
.doc-row .grow .muted { display: block; }
.cert-docs .dive-item .dive-meta { flex-direction: row; align-items: center; gap: 8px; }
.dive-card-head { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.dive-card-head h1 { margin: 0; }
.dive-card h2 { margin-top: 20px; }
.gear-items .dive-main .chip { margin-top: 4px; display: inline-block; }
.dive-item.retired { opacity: .6; }
.service-add { margin-top: 14px; }
/* Insights (app/insights.py): SVG charts in the page's colours; grid and axes recessive */
.chart { width: 100%; max-width: 600px; height: auto; display: block; margin: 8px 0 6px; overflow: visible; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 13px; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.chart .point circle { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart .point .hit { fill: transparent; stroke: none; }
.chart .point:hover circle:not(.hit) { r: 6; }
.chart .bar.this { fill: var(--accent); }
.chart .bar.last { fill: var(--chart-neutral); }
.chart .bar:hover { opacity: .8; }
.seg-links { margin-top: 4px; display: inline-flex; gap: 2px; padding: 2px; background: var(--surface-2); border-radius: 8px; flex-wrap: wrap; }
.seg-links a { padding: 4px 10px; border-radius: 6px; color: var(--muted); font-size: .88rem; font-weight: 600; }
.seg-links a.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); text-decoration: none; }
.chip-filters { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 12px 0 4px; }
.chip-group { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.chip-group .chip { text-decoration: none; }
.year-totals { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; font-size: .92rem; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.swatch.this { background: var(--accent); }
.swatch.last { background: var(--chart-neutral); }
.big-number { font-size: 2rem; font-weight: 800; margin: 8px 0 0; }
.table.compact td, .table.compact th { padding: 6px 10px; }
.table.compact tbody tr { cursor: default; }
.chart .line.second { stroke: var(--chart-second); stroke-dasharray: 7 4; }
.swatch.second { background: var(--chart-second); }
.overlay-wrap { position: relative; margin: 8px 0 22px 34px; }
.overlay-wrap svg { width: 100%; height: 220px; display: block; overflow: visible; }
.overlay-wrap .tick-y { position: absolute; left: -34px; font-size: 11px; color: var(--muted); transform: translateY(-50%); }
.overlay-wrap .tick-x { position: absolute; bottom: -18px; font-size: 11px; color: var(--muted); transform: translateX(-50%); }
.to-plan { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
.to-plan:first-of-type { border-top: 0; margin-top: 4px; padding-top: 0; }
.to-plan h3 { margin: 0 0 4px; }
.computers li { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--border); }
.computers li:first-child { border-top: 0; }
.overlay-wrap .gridline { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.overlay-wrap .line { vector-effect: non-scaling-stroke; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.overlay-wrap .line.second { stroke: var(--chart-second); stroke-dasharray: 7 4; }
.record-row { display: flex; flex-direction: column; color: var(--text); }
.record-row:hover { text-decoration: none; }
.record-row:hover strong { color: var(--accent); }
.year-card img { width: 100%; height: auto; max-width: 420px; border-radius: 14px; display: block; box-shadow: 0 4px 18px rgba(0,0,0,.15); }
.year-card .row-gap { margin-top: 12px; }
.menu-pop.doc-edit { width: min(480px, calc(100vw - 32px)); padding: 12px; }
/* The roster (app/roster.py): the schedule, availability */
.schedule-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.schedule-nav .grow { text-align: center; }
.schedule-day { font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 16px 0 4px; }
.schedule-day.today { color: var(--accent); }
.staff-chips { display: block; margin-top: 4px; }
.staff-chips .chip { margin-bottom: 0; }
.staff-add { margin-top: 12px; }
.avail { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin: 0 1px; background: var(--border); vertical-align: middle; }
.avail-yes { background: var(--ok, #157f3b); }
.avail-no { background: var(--danger); }
.avail-grid td { padding: 8px 4px; }
.avail-day { padding: 10px 0; }
.avail-day + .avail-day { border-top: 1px solid var(--border); }
.avail-day.today .avail-date { color: var(--accent); }
.avail-date { margin: 0 0 6px; }
.avail-part { align-items: center; margin-bottom: 6px; }
.avail-part legend { float: left; width: 84px; flex: 0 0 84px; padding: 0; }
.avail-part .seg span { padding: 6px 8px; }
.planner-terms { max-width: 640px; }
.planner-terms ul { padding-left: 20px; line-height: 1.5; }
.planner-terms li { margin-bottom: 6px; }
.planner-terms label.check { align-items: flex-start; margin: 12px 0 8px; }
.planner-terms label.check input { margin-top: 3px; }
.legal { max-width: 760px; line-height: 1.6; }
.legal h2 { font-size: 1.05rem; margin: 24px 0 6px; }
.legal ul { padding-left: 20px; }
.legal li { margin-bottom: 6px; }
.legal-binding { border-left: 3px solid var(--border); padding-left: 10px; }
.legal-table { width: 100%; border-collapse: collapse; font-size: .92rem; margin: 6px 0 12px; }
.legal-table th, .legal-table td { text-align: left; vertical-align: top; padding: 6px 8px; border-bottom: 1px solid var(--border); }
@media (max-width: 560px) { .legal-table, .legal-table tbody, .legal-table tr, .legal-table td { display: block; }
  .legal-table thead { display: none; } .legal-table td { border: 0; padding: 2px 0; } .legal-table td:first-child { font-weight: 600; } .legal-table tr { padding: 6px 0; border-bottom: 1px solid var(--border); } }

/* auth */
main.auth { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding-top: env(safe-area-inset-top); }
.auth-card { width: 100%; max-width: 380px; padding: 28px; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.auth-brand h1 { margin: 0; }
.btn-provider { gap: 10px; }
.btn-provider svg { width: 18px; height: 18px; flex: none; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .85rem; margin: 18px 0 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

/* small-screen and spacing refinements */
.result details { margin-bottom: 14px; }
@media (max-width: 560px) {
  .dive-item { gap: 10px; align-items: flex-start; }
  .dive-no { width: 30px; padding-top: 2px; }
  .dive-meta { flex-direction: column; align-items: flex-end; gap: 0; font-size: .9rem; }
  .dive-item form .btn { white-space: normal; }
}
.nowrap { white-space: nowrap; }
@media (max-width: 640px) { .table td, .table th { padding: 10px 8px; } }

/* profile & schools */
.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.profile-head h1 { margin: 0; }
.profile-head p { margin: 2px 0 0; }
.photo-pick { position: relative; display: block; cursor: pointer; border-radius: 50%; flex: none; }
.photo-pick .avatar.xl { width: 84px; height: 84px; }
.photo-edit { position: absolute; right: -2px; bottom: -2px; width: 28px; height: 28px; border-radius: 50%; display: grid;
  place-items: center; background: var(--accent); color: #fff; font-size: .8rem; border: 2px solid var(--bg); }
.photo-pick:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.dive-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin: 4px 0 12px; padding: 0; list-style: none; }
#photos .card-head { align-items: center; margin-bottom: 12px; }
#photos .card-head h2 { margin: 0; }
.dive-photos li { position: relative; }
.dive-photos a { display: block; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.dive-photos img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; }
.dive-photos a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dive-photos form { position: absolute; top: 4px; right: 4px; margin: 0; }
.photo-remove { width: 30px; height: 30px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 1rem; line-height: 1; }
.photo-remove:hover, .photo-remove:focus-visible { background: rgba(0, 0, 0, .75); }
.photo-remove:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.photo-add { margin: 0; }
.photo-add label { cursor: pointer; }
.photo-add label:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.photo-add .is-busy { opacity: .7; pointer-events: none; }
.photo-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.photo-actions form { margin: 0; }
.photo-actions .linkbtn { padding: 0; font-size: .85rem; color: var(--accent); }
.role-group + .role-group { margin-top: 18px; }
.people .inline-form select { width: auto; }
.section-title { margin: 28px 0 12px; font-size: 1.2rem; }

/* dashboard tiles: links are raised and show a chevron; key figures are tinted */
a.stat { color: var(--text); text-decoration: none; }
.stat-link { position: relative; padding-right: 30px; box-shadow: 0 1px 2px rgba(16, 35, 46, .08), 0 4px 12px rgba(16, 35, 46, .08);
  transition: transform .12s ease, box-shadow .12s ease; }
.stat-link::after { content: "›"; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 1.4rem;
  line-height: 1; color: var(--muted); }
.stat-link:hover { text-decoration: none; box-shadow: 0 2px 4px rgba(16, 35, 46, .1), 0 8px 20px rgba(16, 35, 46, .12); }
.stat-link:active { transform: translateY(1px); box-shadow: 0 1px 2px rgba(16, 35, 46, .08); }
.stat-key { background: var(--accent-soft); border-color: transparent; }
.stat-key .stat-label { color: var(--accent-strong); }
.stat-sub { color: var(--accent); }
.stat-sub.muted { color: var(--muted); }
.stat-key .stat-sub.muted { color: var(--accent-strong); } /* grey on the tint was 4.35:1; this is over 4.5 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .stat-link { box-shadow: 0 0 0 1px var(--border), 0 4px 14px rgba(0, 0, 0, .35); }
}
:root[data-theme="dark"] .stat-link { box-shadow: 0 0 0 1px var(--border), 0 4px 14px rgba(0, 0, 0, .35); }

/* clickable chart rows */
a.bar-row { color: var(--text); border-radius: 6px; margin: -3px -6px; padding: 3px 6px; }
a.bar-row:hover { background: var(--surface-2); text-decoration: none; }
.more-years { margin-top: 10px; }
.more-years summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: .9rem; margin-bottom: 8px; }
.filter-note { margin: -6px 0 14px; font-size: .9rem; color: var(--muted); }

/* ⋯ dropdown menu */
.dropdown { position: relative; }
.dropdown summary { list-style: none; font-size: 1.2rem; line-height: 1; }
.dropdown summary::-webkit-details-marker { display: none; }
.dropdown .menu-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 5; display: flex; flex-direction: column;
  min-width: 160px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 6px 20px rgba(16, 35, 46, .15); }
.menu-pop a, .menu-pop .linkbtn { display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: 7px; color: var(--text); }
.menu-pop a:hover, .menu-pop .linkbtn:hover { background: var(--surface-2); text-decoration: none; }
.menu-pop .btn-danger { color: var(--danger); }
.btn.btn-danger:not(.btn-ghost) { border-color: var(--danger); }
.btn.btn-danger:not(.btn-ghost):hover { background: var(--danger); color: #fff; }
.menu-pop form { margin: 0; }
.passkey-menu { min-width: 230px; gap: 6px; }
.passkey-menu form.stack { padding: 4px 6px 8px; border-bottom: 1px solid var(--border); }
.dive-head { flex-wrap: nowrap; align-items: flex-start; }

/* dive form */
.fields-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 480px) { .fields-2.stack-sm { grid-template-columns: 1fr; } }
/* date/time: left-aligned (iOS centres them) with a calendar/clock icon at the end */
input[type=date], input[type=time] {
  -webkit-appearance: none; appearance: none; text-align: left; min-height: 44px; padding-right: 40px;
  background-repeat: no-repeat; background-position: right 12px center; background-size: 18px 18px;
}
input[type=date] { background-image: var(--calendar); }
input[type=time] { background-image: var(--clock); }
input::-webkit-date-and-time-value { text-align: left; }
input[type=date]::-webkit-calendar-picker-indicator, input[type=time]::-webkit-calendar-picker-indicator { opacity: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips:empty { display: none; }
.buddy-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 6px; border-radius: 999px;
  background: var(--accent-soft); color: var(--text); font-weight: 500; }
.chip-remove { border: 0; background: none; color: var(--muted); font-size: 1.1rem; line-height: 1; cursor: pointer;
  width: 26px; height: 26px; border-radius: 50%; }
.chip-remove:hover { background: var(--surface); color: var(--danger); }
.avatar.xs { width: 24px; height: 24px; font-size: .75rem; }
.gear-details { margin: 0; }

/* the dive list (/dives), as in the app: number, site with date and place, depth, time, gas; Select ticks dives */
@media (max-width: 900px) { .hide-md { display: none; } }
@media (max-width: 560px) { .hide-xs { display: none; } }
.dive-list-card { padding: 4px 16px; }
.dive-row { display: flex; align-items: center; gap: 4px; }
.dive-row .dive-item { flex: 1; min-width: 0; align-items: center; }
.dive-row .dive-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dive-row .dive-main .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dive-check { display: none; width: 18px; height: 18px; margin: 0 6px 0 0; flex: none; }
.selecting .dive-check { display: block; }
.selecting .dive-row:has(.dive-check:checked) { background: var(--accent-soft); border-radius: 8px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; padding-left: 8px; padding-right: 8px; }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round;
  stroke-linejoin: round; }
.dive-row .dive-meta { flex-direction: row; align-items: center; gap: 10px; font-size: inherit; }
.select-bar { position: sticky; bottom: 12px; z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px;
  box-shadow: var(--shadow); margin-top: 12px; }
.select-bar span { flex: 1; font-weight: 600; }
@media (max-width: 720px) { .select-bar { bottom: calc(76px + env(safe-area-inset-bottom)); } }
.bulk-list { max-height: 14em; overflow: auto; margin: 8px 0 0; }
.stats-more { margin: -4px 0 16px; text-align: right; font-size: .9rem; }
.dive-map { height: 340px; border-radius: 10px; margin-top: 8px; z-index: 0; background: var(--accent-soft); }
.dive-map .leaflet-popup-content { display: grid; gap: 2px; font: inherit; font-size: .85rem; }
@media (max-width: 560px) { .dive-map { height: 260px; } }
/* depth profile on the dive page: time right, depth down; labels are HTML so they don't stretch with the chart */
.profile { margin: 8px 0 0; }
.profile-plot { position: relative; height: 240px; margin-left: 42px; touch-action: pan-y; }
.profile-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.profile-plot svg * { vector-effect: non-scaling-stroke; }
.profile-grid { stroke: var(--border); stroke-width: 1; }
.profile-avg { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; }
.profile-area { fill: var(--accent-soft); }
.profile-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.profile-cursor { stroke: var(--text); stroke-width: 1; }
.profile-y { position: absolute; right: calc(100% + 8px); transform: translateY(-50%); font-size: .75rem; color: var(--muted); white-space: nowrap; }
.profile-max { position: absolute; transform: translate(8px, -50%); font-size: .75rem; font-weight: 600; color: var(--accent-strong); white-space: nowrap; pointer-events: none; }
.profile-max-left { transform: translate(calc(-100% - 8px), -50%); }
.profile-tip { position: absolute; top: 6px; transform: translateX(-50%); background: var(--text); color: var(--surface);
  font-size: .75rem; padding: 3px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none; }
.profile-x { position: relative; height: 22px; margin: 4px 0 0 42px; font-size: .75rem; color: var(--muted); }
.profile-x span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.profile-x span:first-child { transform: none; }
.profile .profile-key { display: inline-block; width: 18px; border-top: 1px dashed var(--muted); vertical-align: middle; }
@media (max-width: 560px) { .profile-plot { height: 180px; } }
.profile-event { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--surface);
  background: var(--accent-strong); box-shadow: 0 0 0 1px var(--accent-strong); vertical-align: middle; }
.profile-plot .profile-event { position: absolute; transform: translate(-50%, -50%); cursor: help; }
.profile-event-gas { background: #16a34a; box-shadow: 0 0 0 1px #16a34a; }
.profile-event-bookmark { background: #7c3aed; box-shadow: 0 0 0 1px #7c3aed; }
.profile-event.is-warning { background: var(--danger); box-shadow: 0 0 0 1px var(--danger); border-radius: 2px; }
.profile-events-head { font-size: .95rem; margin: 16px 0 6px; }
.profile-events { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 16px; font-size: .9rem; }
.profile-events .profile-event { margin-right: 6px; }
.tanks-table { margin-bottom: 8px; }
.choice-row { display: flex; gap: 20px; flex-wrap: wrap; }
.dc-brands-head { font-size: .95rem; margin: 16px 0 6px; }
.dc-brands { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 20px; margin: 0 0 8px; }
.dc-brands dt { font-weight: 600; font-size: .9rem; }
.dc-brands dd { margin: 0; color: var(--muted); font-size: .85rem; }
.navigate { margin: 2px 0 0; }
.rental-actions { margin-bottom: 16px; }
.rental-table .check-col { width: 2.2em; }
.rental-table td { white-space: normal; vertical-align: top; }
@media (max-width: 560px) { .rental-table th, .rental-table td { padding-left: 6px; padding-right: 6px; } }
.tick-box { display: inline-block; width: 16px; height: 16px; border: 1.5px solid var(--muted); border-radius: 3px; vertical-align: middle; }
@media print {
  .topbar, .tabbar, .no-print, .flash { display: none !important; }
  body, main.wrap { background: #fff; color: #000; padding: 0; }
  .card { box-shadow: none; border: 0; padding: 0; margin: 0 0 16px; }
  .table th, .table td { border-bottom: 1px solid #999; }
}
.rental-card summary .muted { font-weight: 400; }
.settings-subhead { margin-top: 20px; }
.settings-tabs { overflow-x: auto; scrollbar-width: none; }
.settings-tabs a { white-space: nowrap; }
.settings-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.settings-list li:last-child { border-bottom: 0; }
.settings-list .muted { flex-basis: 100%; }
.home-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 16px; }
.menu-summary { padding: 7px 9px; }
.menu-summary svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; fill: none; display: block; }
.cert-line { display: block; }
/* The sea animal next to a name in a club (app/ranking.py), and the place in its ranking */
.animal { margin-left: 6px; font-size: 1.1em; line-height: 1; }
.ranking .rank { width: 1.4em; flex: none; text-align: right; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.ranking .chip { margin: 0; white-space: nowrap; }
.count-list { list-style: none; margin: 0; padding: 0; }
.count-list li + li { border-top: 1px solid var(--border); }
.count-list a { display: flex; justify-content: space-between; padding: 9px 6px; color: var(--text); border-radius: 6px;
  font-variant-numeric: tabular-nums; }
.count-list a:hover { background: var(--surface-2); text-decoration: none; }
/* group dive rental */
.rental-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 12px; align-items: center;
  margin-bottom: 12px; }
.rental-item { font-weight: 500; }
.join-form { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.join-form details.more summary { margin-bottom: 8px; }
.ready-list li { display: flex; flex-direction: column; gap: 2px; padding: 8px 6px; }
.rental-line { color: var(--accent-strong); }
.rental-log .dive-meta .btn-ghost { padding-right: 0; } /* "Remove" lines up with the price at the right */
.rental-form .fields-2 input { box-sizing: border-box; height: 46px; } /* the date and the days field the same height */
/* group dive buddy pairs */
.buddy-ask { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.buddy-pick { margin: 12px 0 6px; }
.buddy-pick select { width: auto; min-width: 140px; }
.pair-avatars { display: flex; flex: none; }
.pair-avatars .avatar + .avatar { margin-left: -10px; box-shadow: 0 0 0 2px var(--surface); }

/* training dives per course on the profile */
.course-head { font-size: 1rem; margin: 16px 0 4px; }
.course-head:first-of-type { margin-top: 0; }

/* rental prices (school settings, group dive) */
.price-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 14px; }
.price-input { display: flex; align-items: center; gap: 6px; }
.price-input input { min-width: 0; }
/* rental prices as a table: item, price per dive, % off on following days */
.rental-price-table { display: grid; grid-template-columns: minmax(0, 1fr) 120px 84px; gap: 8px 12px; align-items: center; }
.rental-price-item { font-weight: 500; font-size: .9rem; }
.rental-days { max-width: 140px; }
.rental-total, .rental-due { margin: 4px 0 0; }

/* waking page while the database resumes */
.waking .auth-brand { justify-content: center; }
.waking-spinner { width: 36px; height: 36px; margin: 8px auto 16px; border-radius: 50%; border: 3px solid var(--border);
  border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .waking-spinner { animation-duration: 3s; } }
.discount-field { max-width: 200px; margin-top: 14px; }

/* buddy suggestions on the dive form (a datalist barely works in iOS Safari) */
.suggest-wrap { position: relative; }
.handle-wrap { display: block; flex: 1 1 12em; min-width: 0; }
.handle-wrap input { width: 100%; }
.suggest { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20; list-style: none; margin: 0; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  max-height: 280px; overflow-y: auto; }
.suggest li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--surface-2); }
.suggest li .muted { margin-left: auto; }
/* Staff: edit a participant's rental from the participants list */
.menu-pop.staff-participant { width: min(92vw, 380px); padding: 12px; gap: 8px; }
/* Pop-up (e.g. a member's role): a native <dialog> opened with showModal() */
dialog.modal { width: min(92vw, 420px); padding: 20px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); color: var(--text); box-shadow: 0 12px 40px rgba(0, 0, 0, .3); }
dialog.modal::backdrop { background: rgba(8, 20, 27, .45); }
dialog.modal h2 { margin: 0 0 4px; font-size: 1.1rem; }
.role-option { align-items: flex-start; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; }
.role-option > span { display: flex; flex-direction: column; gap: 2px; }
.role-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

/* Dive planner (/planner) */
.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.tabs a { padding: 8px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--accent-strong); border-bottom-color: var(--accent); }
.unit-input { position: relative; display: block; }
.unit-input input { padding-right: 52px; }
.unit-input .unit { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted);
  font-size: .85rem; pointer-events: none; }
.planner-form fieldset + fieldset { margin-top: 4px; }
.planner-stats { margin-top: 16px; }
.planner-warnings ul { margin: 6px 0 0; padding-left: 18px; }
.profile-chart { margin: 0; }
.profile-chart svg { width: 100%; height: auto; display: block; }
.profile-chart .grid { stroke: var(--border); stroke-width: 1; }
.profile-chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.profile-chart .profile-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.profile-chart .profile-area { fill: var(--accent-soft); opacity: .6; }
.profile-chart .profile-stop { fill: var(--accent); stroke: var(--surface); stroke-width: 2; cursor: help; }
.profile-chart .profile-stop:hover { r: 7; }
.plan-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.plan-table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.plan-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.plan-table tr:last-child td { border-bottom: 0; }
.danger-text { color: var(--danger); }
.planner-note { margin-top: 18px; }
.planner-form .fields.pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.profile-chart .tick { font-size: 12px; }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
/* dark: white on --danger is 2,9:1; the page colour on it is about 6,4:1 */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-danger-solid { color: var(--bg); } }
:root[data-theme="dark"] .btn-danger-solid { color: var(--bg); }
.btn-danger-solid:hover { filter: brightness(1.08); }
button[aria-busy="true"] { cursor: progress; opacity: .75; }

.show-more { display: flex; align-items: center; gap: 12px; justify-content: center; margin: 16px 0; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 20%, transparent); }

/* Account menu behind the profile photo */
.account-menu summary { cursor: pointer; }
.account-menu .menu-pop { min-width: 220px; }
.menu-head { display: flex; flex-direction: column; margin: 0; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-pop a[aria-current="page"] { color: var(--accent); font-weight: 600; }

/* Dive computer page */
.steps { margin: 0 0 12px; padding-left: 1.3em; display: grid; gap: 6px; }
.steps .platforms { margin: 6px 0 0; padding-left: 1.1em; display: grid; gap: 4px; }
.dc-status progress { width: 100%; height: 10px; accent-color: var(--accent); }
.dc-status p { margin: 12px 0 6px; }
.dc-log { width: 100%; font: .78rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
.dc-table tbody tr { cursor: default; }
.dc-table tr.dc-dup td { color: var(--muted); }
.import-choice { display: flex; flex-direction: column; color: inherit; }
.import-choice:hover { text-decoration: none; border-color: var(--accent); }
.import-choice { padding-right: 40px; position: relative; }
.import-choice::after { content: "›"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 1.6rem; color: var(--muted); }
.import-choice h2 { margin-bottom: 4px; }
.import-choice p { margin: 0; }
.import-unsupported { color: var(--danger); }

/* Club trips */
.facts { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 0 0 14px; }
.facts:empty { display: none; }
.facts dt { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.facts dd { margin: 2px 0 0; font-size: 1.15rem; font-weight: 600; }
.trip-facts .btn-block { margin-bottom: 8px; }
.trip-choice { display: flex; flex-wrap: wrap; gap: 8px; }

/* Test deployment: an unmistakable strip on every page */
.site-banner { background: #b45309; color: #fff; text-align: center; font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 8px; }

/* Club management (app/club.py): its own colour, so it's clear you're not in your own logbook */
:root { --club: #6d28d9; --club-soft: #f1ebfd; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --club: #b69cf5; --club-soft: #261b3d; } }
:root[data-theme="dark"] { --club: #b69cf5; --club-soft: #261b3d; }
/* In club mode the club colour replaces the accent everywhere: buttons, links, tiles */
.club-mode { --accent: var(--club); --accent-strong: var(--club); --accent-soft: var(--club-soft); }
.avatar.club-logo { background: var(--club); color: #fff; border-radius: 9px; font-size: .78rem; letter-spacing: .02em; }
.avatar.club-logo.xl { border-radius: 22px; font-size: 2rem; }
.club-bar { background: var(--club-soft); border-bottom: 2px solid var(--club); }
.club-bar .brand { gap: 10px; }
.club-brand { display: flex; flex-direction: column; line-height: 1.15; }
.club-brand-label { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--club); }
.club-bar .nav a.active { color: var(--club); }
.club-bar .btn-primary { background: var(--club); border-color: var(--club); }
.menu-club, .menu-pop .linkbtn:has(.avatar) { display: flex; align-items: center; gap: 8px; }
.club-logo-edit { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

/* Dive form: favourite places and your courses, one tap fills in */
.place-picks { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 4px; }
.place-picks .chip { border: 1px solid var(--border); cursor: pointer; font: inherit; font-size: .85rem; margin: 0; }
.place-picks .chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

/* Scan a paper logbook */
.scan-dive { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px 14px; }
.scan-dive legend { padding: 0 6px; }
.fields-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.scan-pick { justify-self: start; cursor: pointer; }

/* Dive computer: the dives found, in a pop-up wide enough for the table */
dialog.modal.dc-result { width: min(94vw, 640px); max-height: 86vh; overflow: auto; }
dialog.modal.dc-result .table-card { margin: 12px 0; }

/* a club's logo next to its name on the club page, as in the app */
.avatar.club-logo.club-head-logo { width: 56px; height: 56px; border-radius: 14px; font-size: 1.25rem; flex: none;
}
.club-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex: 1 1 100%; }

/* club settings: each part in its own card, as in the app */
.settings-cards .card { margin-bottom: 16px; }
.settings-save { margin: 4px 0 20px; }

/* forms.js: an icon before card titles and form sections; required fields; what's wrong with a field */
.with-icon { display: flex; align-items: center; gap: 10px; }
.title-icon { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent-strong); }
.title-icon svg { width: 18px; height: 18px; fill: currentColor; }
.req { color: var(--muted); font-weight: 600; }
input[aria-invalid=true], select[aria-invalid=true], textarea[aria-invalid=true] { border-color: var(--danger); }
input[aria-invalid=true]:focus, select[aria-invalid=true]:focus, textarea[aria-invalid=true]:focus { outline-color: var(--danger); }
.field-error { color: var(--danger); font-size: .82rem; font-weight: 500; }

/* pin-picker.js: a pin dropped on the dive site */
.pin-field { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pin-dialog { width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; border: 1px solid var(--border);
  border-radius: 14px; background: var(--surface); color: var(--text); overflow: hidden; }
.pin-dialog::backdrop { background: rgb(0 0 0 / .45); }
.pin-head { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px 10px; }
.pin-map { height: min(60vh, 460px); background: var(--accent-soft); }
.pin-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 16px; }
.pin-marker { background: none; border: 0; }
.pin-marker svg { width: 26px; height: 36px; filter: drop-shadow(0 1px 2px rgb(0 0 0 / .35)); }

/* forms.js: a form in steps */
.form-steps { display: flex; gap: 6px; margin-bottom: 18px; scroll-margin-top: 84px; }
.form-step-tab { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 6px;
  border: 0; border-radius: 10px; background: none; color: var(--muted); font: inherit; font-size: .88rem; font-weight: 500; cursor: pointer; }
.form-step-tab[aria-current] { background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; }
.form-step-n { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 50%;
  background: var(--border); color: var(--muted); font-size: .75rem; font-weight: 700; }
.form-step-tab[aria-current] .form-step-n, .form-step-tab.done .form-step-n { background: var(--accent); color: #fff; }
.form-step-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.form-step { display: grid; gap: 24px; }
.form-step[hidden] { display: none; }
.with-icon:has(.legend-note) { width: 100%; }
.legend-note { margin-left: auto; padding-left: 8px; color: var(--muted); font-size: .8rem; font-weight: 500; }

/* Settings › Profile: its pages, as rows */
.settings-menu { padding: 6px 0; }
.settings-row { display: flex; align-items: center; gap: 12px; padding: 14px 20px; color: var(--text); text-decoration: none;
  font-weight: 600; }
.settings-row + .settings-row { border-top: 1px solid var(--border); }
.settings-row:hover { background: var(--surface-2, var(--accent-soft)); }
.settings-row .grow { flex: 1; }
label[hidden] { display: none !important; } /* a label is display: flex (in forms more specifically), which beats the hidden attribute */

/* Certifications and documents: per agency, what you did */
.cert-agency summary { display: flex; align-items: center; gap: 8px; }
.cert-agency > label { margin-top: 12px; }
.cert-group { margin-top: 14px; }
.cert-group legend { font-size: .82rem; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.cert-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 16px; }
/* all of a member's certifications on their profile, for club staff */
.cert-agency-row { padding: 10px 0; border-top: 1px solid var(--border); }
.cert-agency-row .chips { margin-top: 6px; }
.cert-search .cert-suggest { margin-top: 6px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  background: var(--surface); }
.cert-search .cert-pick { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%;
  padding: 10px 14px; border: 0; border-top: 1px solid var(--border); background: none; color: inherit;
  font: inherit; text-align: left; cursor: pointer; }
.cert-search .cert-pick:first-child { border-top: 0; }
.cert-search .cert-pick:hover, .cert-search .cert-pick.active { background: var(--surface-2, rgba(0,0,0,.04)); }
.cert-agency summary .cert-name { display: block; font-weight: 400; margin-top: 2px; }
.cert-agency[hidden] { display: none; }
h2 .cert-status { float: right; font-weight: 400; margin-top: 4px; }
/* two-step verification (Settings › Security) */
.mfa-qr svg { width: 220px; height: 220px; display: block; border-radius: 8px; }
.mfa-secret code { font-size: 1.05rem; letter-spacing: .06em; word-break: break-all; }
.recovery-codes { columns: 2; padding-left: 1.4em; margin: 0 0 16px; }
.recovery-codes li { margin: 4px 0; }
.recovery-codes code { font-size: 1.05rem; letter-spacing: .05em; }
@media print { .topbar, .tabbar, .back, .row-gap { display: none !important; } }
.language-picker { margin-top: 10px; }
.language-picker select { width: auto; display: inline-block; padding: 4px 28px 4px 10px; font-size: .85rem; }
/* Signing up for a course (app/course_signup.py): the honeypot, a frame on a club's site, the slug field */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.signup-done h1 { font-size: 1.4rem; margin-top: 0; }
.slug-input { display: flex; align-items: center; gap: 4px; }
.slug-input .muted { white-space: nowrap; font-size: .9rem; }
.slug-input input { flex: 1; min-width: 0; }
/* A product of a link from the club's site and the course it's for (club_hook.html) */
.hook-product { width: 100%; }
.hook-product select { flex: 1 1 200px; min-width: 0; }
@media (max-width: 600px) { .hook-product .grow { flex-basis: 100%; } }

/* Settings › Account: free against Pro (app/pro.py COMPARE) */
.pro-trial { margin: 12px 0 4px; }
.pro-trial p { margin: 8px 0 0; }
.pro-compare { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: .94rem; }
.pro-compare th, .pro-compare td { padding: 9px 6px; border-top: 1px solid var(--border); text-align: center; vertical-align: middle; }
.pro-compare thead th { border-top: 0; color: var(--muted); font-size: .85rem; font-weight: 600; }
.pro-compare th[scope=row] { text-align: left; font-weight: 500; padding-left: 0; }
.pro-compare td { width: 5.5em; }
.pro-yes { color: var(--accent); vertical-align: middle; }
.pro-no { color: var(--muted); }

/* Diving › Gear: the submenu, and the free limit */
.gear-nav { display: flex; flex-wrap: nowrap; max-width: 100%; margin: 0 0 18px; }
.gear-nav a { padding: 4px 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pro-note { margin-bottom: 16px; }

/* Creating an account: the password's rules, ticked off while you type (password-rules.js) */
.password-rules { list-style: none; margin: -4px 0 0; padding: 0; display: grid; gap: 3px; }
.password-rules li { position: relative; padding-left: 20px; }
.password-rules li::before { content: ""; position: absolute; left: 3px; top: .45em; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--muted); }
.password-rules li.ok { color: var(--ok, #157f3b); }
.password-rules li.ok::before { border: 0; width: 11px; height: 6px; left: 2px; top: .35em; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; border-radius: 0; transform: rotate(-45deg); }
.password-rules li.bad { color: var(--danger); }
.password-rules li.bad::before { border-color: currentColor; }

/* Notifications: what each kind is about, behind an (i) next to its switch */
.toggle-list li.has-info { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 8px; }
.info-btn { width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; padding: 0; }
.info-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.info-btn:hover, .info-btn[aria-expanded="true"] { color: var(--accent); background: var(--accent-soft); }
.info-text { grid-column: 1 / -1; margin: -6px 0 12px 56px; }
.card-head:has(> .info-btn) { align-items: center; margin-bottom: .9rem; }
.card-head:has(> .info-btn) > h2 { margin: 0; }
.card-head > .info-btn { flex-shrink: 0; margin: -8px -8px -8px 8px; }
.card-head + .info-text { margin: 0 0 12px; }
.card-head + .info-text p { margin: 0 0 6px; }

/* A new course: each lesson's own date and time (course-lessons.js) */
.lesson-dates { list-style: none; margin: 4px 0 8px; padding: 0; display: grid; gap: 6px; }
.lesson-dates li { display: grid; grid-template-columns: minmax(0, 1fr) 9.5em 6.5em; gap: 6px; align-items: center; }
.lesson-dates input { min-width: 0; width: 100%; }
.lesson-dates .lesson-title { font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 480px) { .lesson-dates li { grid-template-columns: 1fr 1fr; } .lesson-dates .lesson-title { grid-column: 1 / -1; } }

/* Club settings › Nextdive Pro: the mode, agreeing to the invoice, a licence per member */
.licence-form .agree { margin: 8px 0 4px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); }
.licence-list li { border-top: 1px solid var(--border); }
.licence-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; margin: 0; }
.licence-row .chip { white-space: nowrap; }

/* Admin: price deals with clubs (app/pricing.py) */
.price-deals { margin-bottom: 12px; }
.price-deal-form { border-top: 1px solid var(--border); padding-top: 12px; }
.licence-total { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }

/* Turning licences on: the terms (club_licence_agree.html) */
.agree-terms { margin: 0; padding-left: 20px; display: grid; gap: 8px; overflow-wrap: anywhere; }
.agree-card h3 { margin: 0 0 -10px; }
.billing-to { margin: 0; line-height: 1.5; overflow-wrap: anywhere; }
.agree-card label.check, .licence-form fieldset label.check, .subscription-form label.check, label.check.hook-invite { align-items: flex-start; }
.agree-card label.check input, .licence-form fieldset label.check input, .subscription-form label.check input, label.check.hook-invite input { margin-top: 3px; }
.subscription-form > * + * { margin-top: 14px; }  /* the products, the status and the button apart */

/* Fields side by side: the inputs on one line, also when one label wraps or has "(optional)" next to it */
.fields > label, .fields-2 > label, .fields-3 > label { justify-content: flex-end; }
/* … except beside a field that has a message (a .field made by forms.js): that one keeps its label at the top, so the
   row's other labels must not sink to the bottom of the taller cell */
.fields:has(> .field) > label, .fields-2:has(> .field) > label, .fields-3:has(> .field) > label { justify-content: flex-start; }

/* settings › calendar: a button per calendar app, and the address to copy */
.calendar-apps { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 14px; }
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row input { flex: 1; min-width: 0; font-size: .85rem; }
/* A club's course template (course_template.html): skills one by one, lessons folded up */
fieldset.skill-list { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
fieldset.skill-list legend { font-weight: 600; padding: 0; margin-bottom: 6px; }
fieldset.skill-list ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
fieldset.skill-list li, .skill-add { display: flex; gap: 8px; align-items: center; }
fieldset.skill-list li input, .skill-add input { flex: 1; min-width: 0; }
details.template-lesson { display: block; padding: 0; }
details.template-lesson > summary { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; list-style: none; }
details.template-lesson > summary::-webkit-details-marker { display: none; }
details.template-lesson > summary::after { content: "›"; color: var(--muted); transition: transform .15s; }
details.template-lesson[open] > summary::after { transform: rotate(90deg); }
details.template-lesson > summary .grow { display: flex; flex-direction: column; gap: 2px; }
.template-lesson-body { display: grid; gap: 10px; padding: 0 14px 14px; }
.template-lesson-body .fields-3 { grid-template-columns: 1fr 1.6fr 1fr; }
.template-lesson-body .fields-3 input { min-width: 0; width: 100%; }
[data-course-other][hidden] { display: none; }

/* The side menu (_side_menu.html): ☰ opens it; over the page on a phone, beside it on a wide screen */
.menu-toggle { background: none; border: 0; padding: 8px; margin-left: -8px; border-radius: 8px; color: var(--text); cursor: pointer; display: inline-flex; }
.menu-toggle:hover { background: var(--surface-2); }
.menu-toggle svg { width: 24px; height: 24px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }
.topbar-inner { padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
.topbar-right { margin-left: auto; }
.side-menu { position: fixed; top: 0; bottom: 0; left: 0; width: 264px; z-index: 30;
  background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; padding: 12px 10px calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-100%); transition: transform .2s ease; visibility: hidden; }
.menu-open .side-menu { transform: none; visibility: visible; }
.side-backdrop { position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .35); }
.side-head { margin: 14px 10px 6px; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.side-head:first-child { margin-top: 4px; }
.side-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; color: var(--text); font-weight: 500; }
.side-item:hover { background: var(--surface-2); text-decoration: none; }
.side-item.active { background: var(--accent-soft); color: var(--accent-strong); }
.side-item svg { width: 20px; height: 20px; flex: none; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.side-item .badge { margin-left: auto; }
.side-club-name .club-logo { width: 20px; height: 20px; }
.side-sub { display: grid; margin: 0 0 6px 32px; border-left: 1px solid var(--border); padding-left: 8px; }
.side-sub a { padding: 6px 10px; border-radius: 8px; color: var(--muted); font-size: .94rem; }
.side-sub a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.side-sub a.active { color: var(--club); background: var(--club-soft); font-weight: 600; }
/* Pinned: beside the page, under the top bar, always in view (not on a phone) */
@media (min-width: 760px) {
  .menu-pinned .side-menu { top: calc(59px + env(safe-area-inset-top)); z-index: 9; transition: none; }
  .menu-pinned main.wrap { margin-left: 264px; max-width: min(1080px, calc(100vw - 264px)); }
  .menu-pinned .side-close { display: none; }
}
@media (max-width: 720px) {
  main.wrap { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
  .side-menu { width: min(84vw, 300px); }
}
.side-tools { display: flex; justify-content: flex-end; gap: 4px; }
.side-close, .side-pin { background: none; border: 0; color: var(--muted); padding: 6px 10px; cursor: pointer; border-radius: 8px; font: inherit; }
.side-close { font-size: 1.1rem; }
.side-pin { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; }
.side-pin svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linejoin: round; }
.side-close:hover, .side-pin:hover { background: var(--surface-2); color: var(--text); }
.side-pin[aria-pressed="true"] { color: var(--accent-strong); }
.side-pin[aria-pressed="true"] svg { fill: currentColor; }
.side-pin .pin-on, .side-pin[aria-pressed="true"] .pin-off { display: none; }
.side-pin[aria-pressed="true"] .pin-on { display: inline; }
@media (max-width: 759px) { .side-pin { display: none; } }
.side-club-name .avatar.club-logo { font-size: .55rem; letter-spacing: 0; }
/* Settings › Roles and rights: a right per row, a role per column */
.roles-scroll { overflow-x: auto; margin: 0 -4px; }
.roles-table { border-collapse: collapse; width: 100%; }
.roles-table th, .roles-table td { padding: 8px 4px; border-bottom: 1px solid var(--border); text-align: center; vertical-align: middle; }
.roles-table thead th { font-size: .82rem; vertical-align: bottom; white-space: nowrap; }
.roles-owner-note { display: none; margin: 0 0 4px; }
@media (max-width: 599px) { .roles-table .owner-col { display: none; } .roles-owner-note { display: block; } }
.roles-table thead th .small { display: block; font-weight: 400; }
.roles-table tbody th { text-align: left; font-weight: 600; }
.roles-table tbody tr:last-child > * { border-bottom: 0; }
.roles-table .right-help { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; font-weight: 400; }
.roles-table .owner-cell { color: var(--muted); }
.roles-table input[type=checkbox] { width: 20px; height: 20px; margin: 0; }
.roles-table .role-menu summary { cursor: pointer; list-style: none; font: inherit; font-weight: 700; padding: 0; }
.roles-table .role-menu summary::-webkit-details-marker { display: none; }
.roles-table .role-menu .menu-pop { text-align: left; min-width: 220px; white-space: normal; }
@media (min-width: 760px) { .roles-table .right-help { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; display: block; } }
.planner-form .gas-row, .planner-form .level-row { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px;
  padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
@media (max-width: 560px) { .planner-form .gas-row, .planner-form .level-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.planner-form select { line-height: inherit; }
.plan-table.gas-use th, .plan-table.gas-use td { padding: 8px 6px; vertical-align: top; }
.planner-form .level-row[hidden], .planner-form .level-buttons [hidden], .planner-form .level-limit[hidden],
.planner-form #level-time[hidden] { display: none; }
.planner-form .level-group[hidden], .planner-form .level-none[hidden] { display: none; }
.planner-form .level-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.planner-form .level-name { font-weight: 600; font-size: .9rem; }
.planner-form .chip-level { background: var(--nx-soft); color: var(--nx); vertical-align: middle; margin: 0 0 0 8px; }

/* The prices page (pricing.html) */
.pricing-head { padding: 16px 0 8px; }
.pricing-head h1 { font-size: 2.2rem; letter-spacing: -.02em; margin-bottom: 8px; }
.pricing-group { margin: 24px 0; }
.pricing-group > h2 { margin-bottom: 4px; }
.pricing-group > p { margin: 0 0 12px; }
.price-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 12px; }
.price-card { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.price-card h3 { margin: 0; font-size: 1.05rem; }
.price-card .price { margin: 0; }
.price-card .price b { font-size: 1.6rem; letter-spacing: -.01em; }
.price-card .price + .small { margin: -4px 0 0; }
.price-list { margin: 4px 0 0; padding-left: 1.2em; color: var(--muted); }
.price-list li { margin: 2px 0; }
.price-card .btn { align-self: flex-start; margin-top: auto; }
.pricing-faq dl { margin: 0 0 12px; }
.pricing-faq dt { font-weight: 600; margin-top: 12px; }
.pricing-faq dd { margin: 2px 0 0; color: var(--muted); }
.pricing-company { margin: 16px 0 8px; }
@media (max-width: 520px) { .pricing-head h1 { font-size: 1.8rem; } }
