/* Mein Schießbuch design system: tokens, base styles and the shared components of the landing page and the app.
   Loaded first; the landing page (landing.css) and the app (app.css) add their own styles after it. */

/* 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; }
/* Desktop: the top bar stays put over the full window width and only the area below it (.page-scroll,
   base.html) scrolls, so the scrollbar starts below the top bar. That area always reserves the space of
   the scrollbar: otherwise main (centred, max 1280px) moves by half the scrollbar width between short
   pages and pages that scroll (Windows, classic scrollbars). Smartphones keep scrolling the whole page
   (overlay scrollbars, the browser bar folds away while scrolling); printing too. */
@media screen and (min-width: 601px) {
  html, body { height: 100%; overflow: hidden; }
  body { display: flex; flex-direction: column; }
  .topbar { flex: none; }
  .page-scroll { flex: 1; min-height: 0; overflow-y: auto; scrollbar-gutter: stable; }
  .page-scroll:focus { outline: none; }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-wrap: break-word;  /* long words (e.g. e-mail addresses) wrap instead of sticking out on phones */
}
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 { display: inline-flex; align-items: center; 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 + icons in the first row, navigation below (1500px: the whole navigation incl. Range Buddies fits next to the logo) */
@media (max-width: 1500px) {
  .topbar nav { order: 3; width: 100%; }
}
/* Smartphones (≤ 600px, the same limit as the card view): the main navigation is folded behind
   the menu button (.nav-toggle) and opens as a list below the top bar (.nav-open, base.html) */
.nav-toggle, .topbar .mobile-only { display: none; }
@media (max-width: 600px) {
  .topbar { padding: .5rem .75rem; gap: .5rem .75rem; }
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem;
    padding: 0; border-color: transparent; background: none; color: var(--text);
  }
  .nav-toggle:hover, .nav-toggle[aria-expanded="true"] { background: var(--bg); filter: none; }
  .nav-toggle .icon { font-size: 1.5rem; vertical-align: 0; }
  .topbar nav { display: none; flex-direction: column; gap: .15rem; padding: .25rem 0 .35rem; border-top: 1px solid var(--border); }
  .topbar.nav-open nav { display: flex; }
  .topbar nav a { padding: .6rem .75rem; }
  /* menu button left, profile right, the brand centered between them; the notifications move into the
     profile menu (unread count as a badge on the profile picture), their list hangs from the top bar */
  .nav-toggle + .brand { flex: 1; text-align: center; }
  .topbar .notify-menu { display: contents; }
  .topbar .notify-btn { display: none; }
  .topbar .notify-dropdown { left: .75rem; right: .75rem; top: calc(100% + .25rem); width: auto; }
  .topbar .notify-menu + .user-menu { margin-left: 0; }
  .topbar .user-btn .mobile-only { display: inline-flex; }
  .topbar .user-dropdown .mobile-only { display: flex; }
  }
.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; }
/* Smartphones: the tabs stay in one row that scrolls sideways (the active tab is scrolled into view, base.html);
   edge to edge of main, the bottom line as an inset shadow because the scroll container would clip the overlap */
@media (max-width: 600px) {
  .subnav {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    margin: -.25rem -.75rem 1rem; padding: 0 .75rem; border-bottom: 0; box-shadow: inset 0 -1px var(--border);
  }
  .subnav::-webkit-scrollbar { display: none; }
  .subnav a { flex: none; white-space: nowrap; margin-bottom: 0; padding: .5rem .7rem; }
}

/* Third-level navigation (e.g. admin "Stammdaten"): smaller pills below the tab bar */
.subnav.subnav-3 { gap: .35rem; margin: -.5rem 0 1.25rem; border-bottom: 0; }
.subnav.subnav-3 a {
  padding: .3rem .75rem; font-size: .9rem; border: 1px solid var(--border); border-radius: 999px; margin-bottom: 0;
}
.subnav.subnav-3 a:hover { border-color: var(--muted); }
.subnav.subnav-3 a.active { color: var(--accent); border-color: var(--accent); background: var(--surface); }
@media (max-width: 600px) {
  .subnav.subnav-3 { margin: -.5rem -.75rem 1rem; padding: 0 .75rem .1rem; box-shadow: none; }
  .subnav.subnav-3 a { padding: .3rem .7rem; }
}

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; min-width: 0; }  /* min-width: wide tables scroll inside the card instead of widening it */
.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; }
/* a tile label that wraps keeps its info icon right after the last word, not in a column of its own */
.stat .label.label-row { display: block; }
.stat .label.label-row .info-tip { display: inline-block; vertical-align: -.19em; margin-left: .1rem; }

.table-wrap { overflow-x: auto; position: relative; }  /* relative: clips absolutely positioned descendants (e.g. .sr-only) */
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); }

td.actions { white-space: nowrap; text-align: right; width: 1%; }

/* 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; }
/* One height for every button, with or without an icon (e.g. the header actions "Drucken", "Vorlagen",
   "+ Neue Waffe"): the icon is exactly one line high (1.2em = the button's line-height) and sits in the
   line box instead of hanging below the baseline, so it never makes its button taller. */
.btn .icon, button .icon { font-size: 1.2em; vertical-align: top; }
form.inline { display: inline; }

label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .2rem; }
/* A label with an info icon that opens a short explanation (<details class="info-tip">) */
.label-row { display: flex; align-items: center; gap: .25rem; margin-bottom: .2rem; }
.label-row label { margin-bottom: 0; }
/* a card heading with an info icon */
.heading-row { margin-bottom: .75rem; }
.heading-row h2 { margin: 0; }
/* a label for read-only content (no form control), looks like label */
.label-row .label { font-size: .85rem; color: var(--muted); }
.narrow-field { max-width: 22rem; }
.narrow-field[hidden] { display: none; }
/* read-only list of badges, e.g. the divisions and categories of a training type (ADR 0068) */
.badge-list { list-style: none; margin: .2rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem; }
.badge-list[hidden], .badge-list li[hidden] { display: none; }
/* divisions above categories on the training type form (ADR 0068) */
.competition-overview { display: grid; gap: .9rem; margin-bottom: 1rem; }
.competition-overview[hidden] { display: none; }
.info-tip { position: relative; }
.info-tip summary { list-style: none; cursor: pointer; color: var(--muted); line-height: 0; border-radius: 50%; }
.info-tip summary::-webkit-details-marker { display: none; }
.info-tip summary:hover, .info-tip[open] summary { color: var(--accent); }
.info-tip summary .icon { font-size: 1.05rem; vertical-align: 0; }
.info-tip-body {
  position: absolute; z-index: 30; top: 1.5rem; left: -.4rem; width: min(18rem, calc(100vw - 16px));
  padding: .6rem .75rem; font-size: .85rem; line-height: 1.4; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .15);
}
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; }
/* iOS Safari gives date/time fields a native minimum width (they stick out of the card on the
   right) and centres their value; without the native look they fill the column like any field */
input[type=date], input[type=time], input[type=datetime-local], input[type=month] {
  appearance: none; -webkit-appearance: none; display: block; min-width: 0; max-width: 100%;
  min-height: calc(1.45em + .9rem + 2px); line-height: 1.45; text-align: left;
}
input::-webkit-date-and-time-value { text-align: left; margin: 0; }
/* native selects (touch devices, data-native) look like the combobox: same field, same arrow */
select:not([multiple]) {
  appearance: none; -webkit-appearance: none; padding-right: 2rem; line-height: 1.45;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5.5 7.5 10 12l4.5-4.5' fill='none' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .55rem center; background-size: 1rem;
}


/* Touch devices: 16px fields (iOS Safari zooms into smaller ones on focus) and larger list entries */
@media (pointer: coarse) {
  input, select, textarea { font-size: 16px; }
  .combo-list li { padding: .65rem .6rem; }
}
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; }


.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); }

@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; }
}

/* Tables with class "cards": one card per row on narrow screens instead of scrolling sideways.
   base.html gives every cell its column header as data-label (shown on the left, the value on the
   right) and marks the title cell (.card-title); the ⋮ menu sits in the top right corner.
   .card-hide: cell left out in the card (e.g. the rank "#", or a column that repeats the title). */
@media (max-width: 600px) {
  table.cards, table.cards tbody { display: block; }
  table.cards thead { display: none; }
  table.cards tr { display: flex; flex-direction: column; gap: .15rem; position: relative;
    padding: .65rem 0; border-top: 1px solid var(--border); }
  table.cards tbody:first-of-type tr:first-child { border-top: 0; }
  table.cards td { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
    padding: 0; border: 0; text-align: right; white-space: normal; }
  table.cards td::before { content: attr(data-label); flex: none; max-width: 50%; color: var(--muted);
    font-size: .85rem; text-align: left; }
  table.cards td:empty, table.cards td.card-hide { display: none; }
  table.cards td.card-title { order: -1; display: block; text-align: left; font-weight: 600; padding-right: 2.5rem; }
  table.cards td.card-title::before, table.cards td[colspan]::before, table.cards td.actions::before { content: none; }
  table.cards td[colspan] { display: block; text-align: left; }
  table.cards td.card-title[data-rank]::before { content: attr(data-rank) " "; color: var(--muted); font-size: inherit; }
  table.cards td.actions { position: absolute; top: .35rem; right: 0; width: auto; }
  table.cards tfoot { display: block; }
  table.cards tfoot tr { border-top: 2px solid var(--border); }
}

/* 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); }

/* 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; }
/* iOS Safari data detectors (names, e-mails) must not look like links */
a[x-apple-data-detectors] { color: inherit !important; text-decoration: none !important; font: inherit !important; }
.user-dropdown .menu-user a[x-apple-data-detectors] { pointer-events: none; }
.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; }
}

/* 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; }
/* display and language icons left of the login, each with a small menu (base.html) */
.visitor-menu { position: relative; display: flex; }
.visitor-menu .user-dropdown { min-width: 11rem; }
.visitor-menu .theme-option[aria-checked="true"] { background: var(--bg); font-weight: 600; }
.visitor-menu .lang-code { flex: none; width: 1.2em; text-align: center; font-size: .8rem; font-weight: 600; white-space: nowrap;
  transform: translateY(.08rem); }  /* flex centers the smaller box, not the capitals: down onto the label's cap height */
/* Narrow windows: the menus hang from the whole top bar like the login panel */
@media (max-width: 600px) {
  .visitor-menu { position: static; }
  .visitor-menu .user-dropdown { right: .75rem; top: calc(100% + .25rem); }
}
.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 .55rem; }
  /* logo, both icons and "Anmelden" in one row down to 360px */
  .topbar:has(.auth-area) { column-gap: .5rem; }
  .auth-area { gap: .3rem; }
  .visitor-menu .user-btn { width: 2rem; height: 2rem; }
  .brand { font-size: 1rem; }
}

.btn.big { padding: .7rem 1.3rem; font-size: 1.02rem; font-weight: 600; }

/* 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;
}
/* full width of the content below (e.g. confirmed entry in the logbook form) */
.notice.notice-wide { display: block; max-width: none; }

.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; }

/* 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 p { margin: 0 0 .3rem; }
.site-footer span { margin: 0 .4rem; }
.site-footer a:hover { color: var(--text); }
