/* Material Icons (Google, Apache 2.0) – self-hosted so no request goes to Google Fonts.
   Use {{ icon('name') }} in templates; names: https://fonts.google.com/icons?icon.set=Material+Icons */
@font-face {
  font-family: 'Material Icons'; font-style: normal; font-weight: 400; font-display: block;
  src: url(fonts/material-icons.woff2) format('woff2');
}
.icon {
  font-family: 'Material Icons'; font-weight: normal; font-style: normal; font-size: 1.25em;
  line-height: 1; letter-spacing: normal; text-transform: none; white-space: nowrap; word-wrap: normal;
  direction: ltr; display: inline-block; vertical-align: -.25em; user-select: none;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-feature-settings: 'liga';
}

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #2563eb;
  --accent-text: #ffffff;
  --danger: #dc2626;
  --ok-bg: #dcfce7; --ok-text: #166534;
  --err-bg: #fee2e2; --err-text: #991b1b;
  --warn: #d97706;
  --row-alt: #f8fafc;
  --radius: 8px;
}
/* Dark theme: via the system setting (unless light was chosen explicitly) or chosen explicitly */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f172a;
    --surface: #1e293b;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --border: #334155;
    --accent: #3b82f6;
    --danger: #f87171;
    --ok-bg: #14532d; --ok-text: #bbf7d0;
    --err-bg: #7f1d1d; --err-text: #fecaca;
    --warn: #fbbf24;
    --row-alt: #172033;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --border: #334155;
  --accent: #3b82f6;
  --danger: #f87171;
  --ok-bg: #14532d; --ok-text: #bbf7d0;
  --err-bg: #7f1d1d; --err-text: #fecaca;
  --warn: #fbbf24;
  --row-alt: #172033;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem;
  padding: .6rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.brand .icon { color: var(--accent); }
.topbar nav { display: flex; flex-wrap: wrap; gap: .25rem; }
.topbar nav a { padding: .35rem .7rem; border-radius: 6px; color: var(--muted); }
.topbar nav a:hover { background: var(--bg); text-decoration: none; color: var(--text); }
.topbar nav a.active { background: var(--accent); color: var(--accent-text); }

/* User menu in the top right corner */
.user-menu { margin-left: auto; position: relative; }
/* Narrow windows: logo + icon in the first row, navigation below */
@media (max-width: 1100px) {
  .topbar nav { order: 3; width: 100%; }
}
.user-btn {
  width: 2.25rem; height: 2.25rem; padding: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg); color: var(--muted);
}
.user-btn:hover, .user-btn[aria-expanded="true"] { color: var(--text); border-color: var(--muted); filter: none; }
.user-btn .icon { font-size: 1.3rem; vertical-align: 0; }
.user-dropdown {
  position: absolute; right: 0; top: calc(100% + .4rem); min-width: 13rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .15); padding: .4rem; z-index: 20;
}
.user-dropdown[hidden] { display: none; }
.user-dropdown .menu-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .35rem .55rem .25rem; }
.user-dropdown .menu-hint { font-size: .8rem; color: var(--muted); padding: .2rem .55rem .35rem; }
.user-dropdown hr { border: 0; border-top: 1px solid var(--border); margin: .35rem 0; }
.theme-option {
  display: flex; width: 100%; align-items: center; gap: .55rem; color: var(--text); border: 0; background: none;
  padding: .45rem .55rem; border-radius: 6px; text-align: left;
}
.theme-option:hover { background: var(--bg); filter: none; }
/* Theme choice: one row with a compact three-way segmented switch (system / light / dark) */
.theme-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding-right: .3rem; }
.theme-row .menu-label { padding-top: .25rem; }
.theme-switch {
  display: inline-flex; padding: 2px; gap: 2px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--border);
}
.theme-switch button {
  display: inline-flex; border: 0; background: none; padding: .2rem .45rem; border-radius: 999px;
  font-size: .85rem; line-height: 1.2; cursor: pointer; opacity: .55;
}
.theme-switch button:hover { opacity: 1; filter: none; }
.theme-switch button[aria-checked="true"] {
  background: var(--surface); opacity: 1; box-shadow: 0 1px 2px rgba(0,0,0,.2);
}

/* Second-level navigation (e.g. statistics): tabs below the page heading */
.subnav {
  display: flex; flex-wrap: wrap; gap: .25rem; margin: -.25rem 0 1.25rem;
  border-bottom: 1px solid var(--border);
}
.subnav a {
  padding: .5rem .85rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.subnav a:hover { color: var(--text); text-decoration: none; border-bottom-color: var(--border); }
.subnav a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.subnav .count-badge { margin-left: .35rem; }

main { max-width: 1280px; margin: 0 auto; padding: 1.25rem; }
h1 { font-size: 1.5rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
/* Further section of a form card (e.g. Waffen, Bestätigung in the logbook form): the same space above every section */
h2.form-section { margin-top: 2rem; }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.head h1, .head h2 { margin: 0; }
.head-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.small { font-size: .85rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.15rem; margin-bottom: 1.25rem;
}
.grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid > .card { margin-bottom: 0; }
.stats { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 1.25rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem; }
.stat .label { color: var(--muted); font-size: .85rem; }
.stat .value { font-size: 1.6rem; font-weight: 650; font-variant-numeric: tabular-nums; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .45rem .6rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
tbody tr:hover { background: var(--row-alt); }
/* Logbook: highlight a whole entry (all of its firearm lines) together */
tbody.entry-group tr:hover { background: none; }
tbody.entry-group:hover { background: var(--row-alt); }
tr.group-start td { border-top: 2px solid var(--border); }
td.actions { white-space: nowrap; text-align: right; width: 1%; }
/* notification settings (account): one row per type, a checkbox column per channel */
.notification-settings th.center, .notification-settings td.center { text-align: center; width: 6rem; }
.notification-settings input[type=checkbox] { width: 1.1rem; height: 1.1rem; }
.notification-settings input[type=checkbox]:disabled { opacity: .55; cursor: not-allowed; }
.setting-label { display: inline-flex; align-items: center; gap: .5rem; }
.setting-label .icon { color: var(--muted); }
/* Rows that open their edit page on click (see row_menu in macros.html) */
[data-href] { cursor: pointer; }
tfoot td { font-weight: 650; }

/* Badges per training type (class = type name from the master data) */
.badge { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .78rem; background: var(--bg); border: 1px solid var(--border); }
.badge.competition { background: var(--badge-competition-bg, #fef3c7); color: var(--badge-competition-text, #92400e); border-color: var(--badge-competition-border, #fcd34d); }
.badge.course { background: var(--badge-course-bg, #e0e7ff); color: var(--badge-course-text, #3730a3); border-color: var(--badge-course-border, #a5b4fc); }
.badge.other { background: var(--badge-range-duty-bg, #f3e8ff); color: var(--badge-range-duty-text, #6b21a8); border-color: var(--badge-range-duty-border, #d8b4fe); }
:root[data-theme="dark"] {
  --badge-competition-bg: #451a03; --badge-competition-text: #fcd34d; --badge-competition-border: #92400e;
  --badge-course-bg: #1e1b4b; --badge-course-text: #c7d2fe; --badge-course-border: #3730a3;
  --badge-range-duty-bg: #3b0764; --badge-range-duty-text: #e9d5ff; --badge-range-duty-border: #6b21a8;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --badge-competition-bg: #451a03; --badge-competition-text: #fcd34d; --badge-competition-border: #92400e;
    --badge-course-bg: #1e1b4b; --badge-course-text: #c7d2fe; --badge-course-border: #3730a3;
    --badge-range-duty-bg: #3b0764; --badge-range-duty-text: #e9d5ff; --badge-range-duty-border: #6b21a8;
  }
}
.warn { color: var(--warn); font-weight: 600; }

.btn, button {
  display: inline-block; padding: .45rem .9rem; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; cursor: pointer; line-height: 1.2;
}
.btn:hover, button:hover { text-decoration: none; filter: brightness(.96); }
.btn.primary, button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.danger, button.danger { color: var(--danger); }
.btn.small, button.small { padding: .2rem .55rem; font-size: .85rem; }
form.inline { display: inline; }

label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .2rem; }
input, select, textarea {
  width: 100%; padding: .45rem .55rem; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text); font: inherit;
}
input[type=checkbox], input[type=radio] { width: auto; }

/* Combobox (static/combo.js): every select becomes an input that opens like a select and
   filters its options while typing; the original select stays hidden in the form */
.combo { position: relative; }
.combo-native { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
.combo-input { padding-right: 2rem; cursor: pointer; text-overflow: ellipsis; }
.combo-input:focus { cursor: text; }
.combo-arrow {
  position: absolute; right: .35rem; top: 50%; transform: translateY(-50%);
  display: flex; padding: .2rem; color: var(--muted); cursor: pointer;
}
.combo-arrow svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.combo-list {
  position: fixed; z-index: 40; overflow-y: auto; margin: 0; padding: .3rem; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .15); text-align: left;
}
.combo-list[hidden], .combo-list li[hidden] { display: none; }
.combo-list li { padding: .4rem .55rem; border-radius: 6px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo-list li.active { background: var(--bg); }
.combo-list .combo-group { padding: .5rem .55rem .2rem; font-size: .75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; cursor: default; }
/* an ungrouped option after a group (e.g. "Leihwaffe" at the end) is set apart so it does not look like part of it */
.combo-list .combo-after-group { border-top: 1px solid var(--border); margin-top: .3rem; padding-top: .55rem; }
.combo-list .combo-new { color: var(--accent); white-space: normal; }  /* may wrap in narrow columns */
.combo-list .combo-empty { cursor: default; }
.combo-hint { margin: .25rem 0 0; }
textarea { min-height: 4rem; }
.form-grid { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 1rem; }
.form-grid .wide { grid-column: 1 / -1; }
/* Fixed three columns (e.g. address: street + house number, then postal code, city, country) */
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
/* Flex rows sized by content: text fields share the remaining width, .short (numbers)
   and .date fields keep a fixed width that fits their value */
.form-rows { display: flex; flex-direction: column; gap: .9rem; margin-bottom: 1rem; }
.form-row { display: flex; flex-wrap: wrap; gap: .9rem; }
.form-row > div { flex: 1 1 13rem; min-width: 0; }
.form-row > .short { flex: 0 0 8.5rem; }
.form-row > .date { flex: 0 0 10.5rem; }
.form-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }
.form-actions .spacer { flex: 1; }
.check { display: flex; align-items: center; gap: .4rem; color: var(--text); font-size: .95rem; }

/* Filter rows always span the full width: the search field (.q) takes the remaining
   space, .narrow fields (short selects) and .actions (buttons) only take what they need */
.filter { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; }
.filter > div { min-width: 140px; flex: 1; }
.filter .q { flex: 3 1 14rem; }
.filter .narrow { flex: 0 1 10rem; min-width: 8rem; }
.filter .actions { flex: 0 0 auto; min-width: 0; }
/* forces the following fields onto a new line (e.g. search row, then filter row) */
.filter .break { flex: 0 0 100%; min-width: 0; height: 0; }

/* Chosen ammunition types of the price trend, each with a remove link */
.type-chips { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .8rem; }
.type-chip { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; padding: .15rem .3rem .15rem .6rem; }
.type-chip a { color: var(--muted, inherit); text-decoration: none; font-size: 1rem; line-height: 1; padding: 0 .2rem; border-radius: 999px; }
.type-chip a:hover { color: var(--text); background: var(--border); }

/* Firearm lines in the logbook form */
.line-table td { padding: .3rem .25rem; vertical-align: middle; }
/* icon-only button, e.g. the trash can that removes a firearm line */
.icon-btn { display: inline-flex; align-items: center; justify-content: center; padding: .35rem; line-height: 0; }
.icon-btn svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
/* the caliber column is only needed for loaner guns */
.line-table:not(.has-loaner) .caliber-col, .line-table:not(.has-loaner) .col-caliber { display: none; }
.line-table input, .line-table select { padding: .35rem .4rem; }
/* fixed column widths: firearm and rounds stay compact, notes take the rest of the row */
.line-table { table-layout: fixed; min-width: 34rem; }
.line-table .col-firearm { width: 15rem; }
.line-table .col-caliber { width: 10rem; }
.line-table .col-rounds { width: 6rem; }
.line-table .col-remove { width: 2.75rem; }
.line-table .num-input { width: 100%; }

.flash { padding: .65rem 1rem; border-radius: 6px; margin-bottom: 1rem; }
.flash.ok { background: var(--ok-bg); color: var(--ok-text); }
.flash.error { background: var(--err-bg); color: var(--err-text); }

.chart-box { position: relative; height: 300px; }

@media (max-width: 640px) {
  main { padding: .75rem; }
  .grid { grid-template-columns: 1fr; }
  .form-grid.cols-3 { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .form-row > .short, .form-row > .date { flex: 1 1 8rem; }
}


/* Row action menu (⋮) */
.row-menu { display: inline-block; vertical-align: middle; }
.row-menu-btn {
  width: 2rem; height: 2rem; padding: 0; border-radius: 6px; border-color: transparent;
  background: none; color: var(--muted); display: inline-flex; align-items: center; justify-content: center;
}
.row-menu-btn:hover, .row-menu-btn[aria-expanded="true"] { background: var(--bg); color: var(--text); border-color: var(--border); filter: none; }
.row-menu-btn .icon { font-size: 1.25rem; vertical-align: 0; }
.row-menu-list {
  position: fixed; z-index: 30; min-width: 10rem; padding: .3rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .15); text-align: left;
}
.row-menu-list[hidden] { display: none; }
.row-menu-list form { margin: 0; }
.row-menu-list a, .row-menu-list button {
  display: flex; align-items: center; gap: .5rem; width: 100%; padding: .45rem .6rem; border: 0; border-radius: 6px;
  background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.row-menu-list a:hover, .row-menu-list button:hover { background: var(--bg); text-decoration: none; filter: none; }
.row-menu-list .danger { color: var(--danger); }

/* Login page */
.login-card { max-width: 26rem; margin: 3rem auto; text-align: center; padding: 2rem 1.5rem; }
.login-card h1 { margin-top: 0; }
.google-btn { display: inline-flex; align-items: center; gap: .6rem; padding: .6rem 1.1rem; font-weight: 600; }
.google-btn svg { width: 1.2rem; height: 1.2rem; }

/* User menu: logged-in user */
.user-btn img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.user-dropdown .menu-user { padding: .2rem .55rem .35rem; line-height: 1.3; }
.user-dropdown .menu-user strong { display: block; }
.user-dropdown .menu-user span { font-size: .8rem; color: var(--muted); word-break: break-all; }
.user-dropdown form { margin: 0; }
.user-dropdown a.theme-option { color: var(--text); }
.user-dropdown a.theme-option:hover { text-decoration: none; }

/* Toasts: all flash messages, bottom right, hidden after 5 seconds by base.html ("error" in red) */
.toasts {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 50;
  display: flex; flex-direction: column; gap: .5rem; align-items: flex-end;
  max-width: calc(100vw - 2rem);
}
.toast {
  background: var(--ok-bg); color: var(--ok-text); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .7rem 1rem; cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .15);
  animation: toast-in .25s ease-out;
  transition: opacity .3s, transform .3s;
}
.toast.error { background: var(--err-bg); color: var(--err-text); }
.toast.hiding { opacity: 0; transform: translateY(.5rem); }
@keyframes toast-in { from { opacity: 0; transform: translateY(.5rem); } }
@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; transition: none; }
}

/* Admin → Benutzer: blocked users */
.badge.blocked { background: var(--err-bg); color: var(--err-text); border-color: transparent; }
tr.blocked-user td { color: var(--muted); }

/* Admin → Benutzer: open/close the registration of new users */
.registration form { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; justify-content: space-between; }
/* description of a statistics page (community statistics: preceded by the community note), below the second-level navigation */
.page-note { margin: -.5rem 0 1rem; }
.page-note p { margin: 0 0 .35rem; }

/* Visitors: login / sign-up buttons in the top right corner and the panel they open */
.auth-area { margin-left: auto; position: relative; display: flex; align-items: center; gap: .5rem; }
.auth-area + .user-menu { margin-left: 0; }
.auth-panel {
  position: absolute; right: 0; top: calc(100% + .5rem); width: min(22rem, calc(100vw - 2rem));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .15); padding: 1.1rem 1.2rem; z-index: 20;
}
.auth-panel[hidden], .auth-panel [hidden] { display: none; }
.auth-panel h2 { margin-bottom: .35rem; }
.auth-panel p { margin: 0 0 .9rem; }
.auth-panel p.small { margin: .9rem 0 0; }
.auth-panel .google-btn { width: 100%; justify-content: center; }
/* Narrow windows: the panel hangs from the whole (sticky, hence positioned) top bar */
@media (max-width: 600px) {
  .auth-area { position: static; }
  .auth-panel { left: 1rem; right: 1rem; top: calc(100% + .25rem); width: auto; }
}
@media (max-width: 480px) {
  .auth-area .btn { padding: .4rem .65rem; }
  .brand { font-size: 1rem; }
}

/* Landing page (GET / for visitors) */
.btn.big { padding: .7rem 1.3rem; font-size: 1.02rem; font-weight: 600; }
.hero { text-align: center; padding: 3.5rem 1rem 2.5rem; max-width: 46rem; margin: 0 auto; }
.hero-kicker { color: var(--accent); font-weight: 650; margin: 0 0 .6rem; }
.hero h1 { font-size: clamp(1.8rem, 5vw, 2.7rem); line-height: 1.15; margin: 0 0 1rem; letter-spacing: -.01em; }
.hero-lead { font-size: 1.1rem; color: var(--muted); margin: 0 auto 1.6rem; max-width: 38rem; }
/* Info notice (e.g. closed registration in the sign-up panel) */
.notice {
  display: inline-block; margin: 0 auto 1.4rem; padding: .65rem 1rem; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  text-align: left; max-width: 38rem;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center; margin-bottom: .9rem; }
.features { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin: 1rem 0 1.25rem; }
.features .card { margin-bottom: 0; }
.feature h2 { margin: .6rem 0 .35rem; }
.feature p { margin: 0; }
.feature p + p { margin-top: .5rem; }
.feature-icon {
  width: 2.6rem; height: 2.6rem; border-radius: 10px; background: var(--bg);
  display: flex; align-items: center; justify-content: center; color: var(--accent);
}
.feature-icon .icon { font-size: 1.5rem; vertical-align: 0; }
.theme-option .icon, .row-menu-list .icon { color: var(--muted); vertical-align: 0; }
.row-menu-list .danger .icon { color: inherit; }
.cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.cta h2 { margin-bottom: .25rem; }
.cta p { margin: 0; }

/* Privacy policy and imprint: full-width card like every other box, text uses the full width too */
.legal h2 { margin-top: 1.6rem; }
.legal h3 { font-size: 1rem; margin: 1.1rem 0 .4rem; }
.legal p, .legal ul { line-height: 1.55; }
.legal li { margin-bottom: .35rem; }
.placeholder { color: var(--danger); font-weight: 600; }

/* Footer with the link to the privacy policy */
.site-footer { max-width: 1280px; margin: 0 auto; padding: .5rem 1.25rem 1.5rem; font-size: .85rem; text-align: center; }
.site-footer, .site-footer a { color: var(--muted); }
.site-footer span { margin: 0 .4rem; }
.site-footer a:hover { color: var(--text); }

/* Account page: label / value list */
.account-facts { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.25rem; margin: 0 0 1rem; }
.account-facts dt { color: var(--muted); }
.account-facts dd { margin: 0; }

/* Friends page: own friend code, code input, friend list with profile picture */
.friend-code { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin: .5rem 0 1rem; }
.friend-code code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 1.6rem; font-weight: 600;
  letter-spacing: .2em; padding: .35rem .8rem; border: 1px dashed var(--border); border-radius: var(--radius);
  background: var(--bg); user-select: all; }
.code-input { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: uppercase; letter-spacing: .15em; }
.code-input::placeholder { text-transform: none; letter-spacing: normal; font-family: inherit; }
.friend-name { display: inline-flex; align-items: center; gap: .6rem; }
.avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none;
  display: inline-flex; align-items: center; justify-content: center; background: var(--bg); color: var(--muted); }
.avatar .icon { font-size: 18px; }

/* Notifications (mail icon left of the user menu) and the indicators for open Range Buddy requests */
.notify-menu { margin-left: auto; position: relative; }
.notify-menu, .notify-menu + .user-menu { display: flex; }
.notify-menu + .user-menu { margin-left: -1rem; }
.user-btn { position: relative; }
.count-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 1.2rem; height: 1.2rem;
  padding: 0 .35rem; border-radius: 999px; background: var(--danger); color: #fff; font-size: .72rem; font-weight: 700;
  line-height: 1; vertical-align: middle; }
.theme-option .count-badge { margin-left: auto; }
.count-badge.on-icon { position: absolute; top: -.3rem; right: -.35rem; border: 2px solid var(--surface); height: 1.3rem; }
.dot-indicator { position: absolute; top: -1px; right: -1px; width: .7rem; height: .7rem; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--surface); }
.notify-dropdown { width: min(22rem, calc(100vw - 2rem)); }
.notify-dropdown { max-height: min(32rem, calc(100vh - 6rem)); overflow-y: auto; }
.notify-dropdown form { margin: 0; }
.notify-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.notify-head .link-btn { border: 0; background: none; box-shadow: none; padding: .35rem .55rem; color: var(--accent);
  font-size: .8rem; font-weight: 400; }
.notify-head .link-btn:hover { text-decoration: underline; filter: none; }
/* a notification is a button (PATCH marks it as read), styled like a menu entry */
.notification { display: flex; width: 100%; gap: .6rem; align-items: flex-start; padding: .55rem; border: 0;
  border-radius: 6px; background: none; box-shadow: none; color: var(--muted); font: inherit; font-weight: 400;
  text-align: left; line-height: 1.35; }
.notification:hover { background: var(--bg); filter: none; }
.notification.unread { color: var(--text); }
.notification .icon { color: var(--muted); margin-top: .1rem; }
.notification.unread .icon { color: var(--accent); }
.notification-date { display: block; font-size: .78rem; color: var(--muted); margin-top: .15rem; }
.notification .unread-label { color: var(--danger); font-weight: 600; }
/* Range Buddies page: received and sent requests */
.request-list { list-style: none; margin: 0; padding: 0; }
.request-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem;
  padding: .7rem 0; border-top: 1px solid var(--border); }
.request-list li:first-child { border-top: 0; }
.request-list .friend-name > span { display: flex; flex-direction: column; }
.request-list .friend-name > span > strong + code, .request-list code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .05em; }
.request-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.request-actions form { margin: 0; }
h2 .count-badge { margin-left: .35rem; }
#requests { scroll-margin-top: 8rem; }
/* the mail icon has no circle of its own, unlike the profile picture */
.notify-btn, .notify-btn:hover, .notify-btn[aria-expanded="true"] { background: none; border-color: transparent; box-shadow: none; }
.notify-btn .icon { font-size: 1.5rem; line-height: 1; display: block; }
.notify-menu { align-self: center; align-items: center; }
.notify-menu + .user-menu { align-self: center; align-items: center; }

/* Confirmations of logbook entries by range buddies (ADR 0026) */
.badge .icon { font-size: .95em; vertical-align: -.12em; }
.badge.confirmed { background: var(--ok-bg); color: var(--ok-text); border-color: transparent; }
.badge.declined { background: var(--err-bg); color: var(--err-text); border-color: transparent; }
.badge.pending { color: var(--muted); }
.buddy-table { min-width: 24rem; }
.line-table .col-buddy { width: 18rem; }
.confirm-facts { display: grid; grid-template-columns: max-content 1fr; gap: .2rem 1rem; margin: .25rem 0 0; }
.confirm-facts dt { color: var(--muted); }
.confirm-facts dd { margin: 0; }
.confirmed-icon { color: var(--ok-text); }
.confirm-indicator { display: inline-block; vertical-align: middle; margin-right: .15rem; }
.request { padding: .9rem 0; border-top: 1px solid var(--border); }
.request p { margin: 0 0 .4rem; }
.request-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.request-actions form { margin: 0; }
.request-actions.inline { margin: 0; }
/* Open confirmation request: what happens in the own logbook, then confirm or decline (ADR 0035) */
form.request { margin: 0; }
.logbook-choice { margin: .75rem 0 0; padding: .5rem .75rem; border: 1px solid var(--border); border-radius: var(--radius); }
.logbook-choice legend { padding: 0 .3rem; color: var(--muted); font-size: .875rem; }
.logbook-choice label { display: flex; align-items: baseline; gap: .5rem; padding: .3rem 0; cursor: pointer; }
.logbook-choice input { flex: none; margin: 0; }
.request-actions.decision button.primary { min-width: 9rem; }
@media (max-width: 600px) {
  .request-actions.decision { flex-wrap: nowrap; }
  .request-actions.decision button.primary { flex: 1; }
}
.entry-note { margin: .35rem 0 0; display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
/* Answered confirmation requests: one card per row on small screens (ADR 0035) */
@media (max-width: 600px) {
  .answered-table thead { display: none; }
  .answered-table tr { display: grid; grid-template-columns: 1fr auto; gap: .35rem .5rem; padding: .75rem 0;
    border-top: 1px solid var(--border); }
  .answered-table tbody tr:first-child { border-top: 0; }
  .answered-table td { display: block; padding: 0; border: 0; }
  .answered-table td.from { grid-column: 1; grid-row: 1; font-weight: 600; align-self: center; }
  .answered-table td.actions { grid-column: 2; grid-row: 1; }
  .answered-table td.state { grid-column: 1 / -1; grid-row: 2; }
  .answered-table td.entry { grid-column: 1 / -1; grid-row: 3; }
}
