:root {
  --fg: #1c2024; --muted: #6b7280; --line: #e5e7eb; --bg: #f7f8fa;
  --ok: #16a34a; --warn: #d97706; --danger: #dc2626; --stale: #7c3aed;
}
* { box-sizing: border-box; }
body { font: 15px/1.5 -apple-system, Segoe UI, Roboto, sans-serif;
       color: var(--fg); background: var(--bg); margin: 0;
       min-height: 100vh; display: flex; flex-direction: column; }
/* Header: club name left, brand centered (grid keeps it centered), controls right. */
header { background: #fff; border-bottom: 1px solid var(--line);
         padding: .7rem 1rem; display: grid; align-items: center; gap: .8rem;
         grid-template-columns: 1fr auto 1fr;
         position: sticky; top: 0; z-index: 30; }
header .head-left { display: flex; align-items: center; gap: .8rem; min-width: 0; }
header .head-right { display: flex; align-items: center; gap: .8rem; justify-content: flex-end; }
header .tenant { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header .brand { font-weight: 700; letter-spacing: -.02em; }
header .brand a { color: var(--fg); text-decoration: none; }
header .lang a { color: var(--muted); text-decoration: none; margin-left: .4rem; cursor: pointer; }
header .lang a.active { color: var(--fg); font-weight: 600; }
#hamburger { display: inline-flex; align-items: center; justify-content: center;
             font-size: 1.2rem; line-height: 1; padding: .25rem .55rem; border-radius: 8px;
             border: 1px solid var(--line); background: #fff; cursor: pointer; }

/* App shell — mobile-first: single column, sidebar is an off-canvas drawer. */
.shell { position: relative; flex: 1; }

/* Legal links (Impressum/Datenschutz) — always visible, signed in or not.
   Sticky at the viewport bottom (mirrors the sticky header). */
.site-footer { border-top: 1px solid var(--line); background: #fff;
               padding: .45rem 1rem; text-align: center;
               font-size: .8rem; color: var(--muted);
               position: sticky; bottom: 0; z-index: 20; }
.site-footer a { color: var(--muted); text-decoration: none; margin: 0 .35rem; }
.site-footer a:hover { color: var(--fg); text-decoration: underline; }
mark { background: #fef3c7; padding: 0 .15rem; border-radius: 3px; }  /* legal placeholders */
#sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 250px; z-index: 40;
  background: #fff; border-right: 1px solid var(--line); padding: 1rem .8rem;
  overflow-y: auto; transform: translateX(-100%); transition: transform .2s ease;
}
body.nav-open #sidebar { transform: translateX(0); box-shadow: 0 0 30px rgba(0,0,0,.15); }
#backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,.35); }
#backdrop[hidden] { display: none; }
main { padding: 1.2rem 1rem; }

/* Sidebar navigation */
.nav-tenant { width: 100%; margin-bottom: .8rem; }
.nav-tenant select { width: 100%; }
.nav-section { color: var(--muted); font-size: .78rem; font-weight: 600;
               text-transform: uppercase; letter-spacing: .03em; margin: 1rem .4rem .3rem; }
.nav-item { display: flex; align-items: center; gap: .55rem; padding: .45rem .55rem;
            border-radius: 8px; color: var(--fg); text-decoration: none; }
.nav-item:hover { background: var(--bg); }
.nav-item.active { background: #e8efff; color: #1d4ed8; font-weight: 600; }
h1 { font-size: 1.3rem; margin: 0 0 1rem; }
h2 { font-size: 1rem; color: var(--muted); font-weight: 600; margin: 1.4rem 0 .6rem; }
a { color: #2563eb; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px;
        padding: 1rem 1.2rem; margin-bottom: .8rem; }

/* Home: hero line + asset tile grid */
.hero { margin: .2rem 0 1.4rem; }
.hero h1 { font-size: 1.7rem; margin: 0; }
.hero .sub { margin: .15rem 0 0; font-size: .95rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: .7rem; }
.tile { display: block; background: #fff; border: 1px solid var(--line); border-radius: 10px;
        padding: .8rem .9rem; color: var(--fg); text-decoration: none; }
.tile:hover { border-color: #2563eb; }
.tile .sub { margin-top: .25rem; }
.tile.ghost { border-style: dashed; background: none; color: var(--muted);
              display: flex; align-items: center; justify-content: center; }
.row { display: flex; align-items: center; gap: .8rem; }
.row .spacer { flex: 1; }
.sub { color: var(--muted); font-size: .87rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .4rem; border-bottom: 1px solid var(--line);
         vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase;
     letter-spacing: .03em; }
.badge { display: inline-block; padding: .12rem .5rem; border-radius: 999px;
         font-size: .78rem; font-weight: 600; color: #fff; white-space: nowrap; }
.badge.ok { background: var(--ok); } .badge.warn { background: var(--warn); }
.badge.danger { background: var(--danger); } .badge.stale { background: var(--stale); }
.badge.muted { background: var(--muted); }
.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); }
.dot.danger { background: var(--danger); } .dot.stale { background: var(--stale); }
.dot.muted { background: var(--muted); }
button, .btn { font: inherit; cursor: pointer; border: 1px solid var(--line);
        background: #fff; border-radius: 8px; padding: .35rem .8rem; color: var(--fg);
        text-decoration: none;
        transition: background .12s ease, border-color .12s ease, box-shadow .12s ease, transform .04s ease; }
button:hover:not(:disabled), .btn:hover:not(:disabled) { background: var(--bg); border-color: #cfd4da; }
button:active:not(:disabled), .btn:active:not(:disabled) { background: #e9ecef; transform: translateY(1px); }
button:focus-visible, .btn:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
button.primary { background: #2563eb; color: #fff; border-color: #2563eb; }
button.primary:hover:not(:disabled) { background: #1d4ed8; border-color: #1d4ed8;
        box-shadow: 0 2px 8px rgba(37, 99, 235, .28); }
button.primary:active:not(:disabled) { background: #1e40af; border-color: #1e40af; box-shadow: none; }
button:disabled { opacity: .5; cursor: default; }
/* ---- Forms: one coherent system --------------------------------------
   All controls share font/border/radius; layout comes from .form (vertical
   stack), .form-row (side by side, wraps when narrow) and .field (label
   above control). Views compose these instead of inventing inline styles. */
input, select, textarea {
  font: inherit; color: var(--fg); background: #fff;
  border: 1px solid var(--line); border-radius: 8px;
  padding: .45rem .6rem; min-width: 0;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid #2563eb; outline-offset: 1px;
}
input[type=checkbox], input[type=radio] { width: auto; padding: 0; border: none;
  accent-color: #2563eb; }
input[type=file] { border: none; background: none; padding: .2rem 0; border-radius: 0; }
input[readonly] { background: var(--bg); color: var(--muted); }
::placeholder { color: #9aa1a9; }

.form { display: flex; flex-direction: column; gap: .75rem; }
.form-card { max-width: 520px; }
.form-card.compact { max-width: 380px; }
.form-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.form-row > * { flex: 1 1 8rem; min-width: 0; }
.form-row > button { flex: 0 0 auto; align-self: flex-end; }
.form button, .form-row > button { padding: .45rem .9rem; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field > span { font-size: .78rem; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea,
.form > input, .form > select { width: 100%; }
.empty { color: var(--muted); padding: 1.2rem; text-align: center; }
.error { color: var(--danger); padding: .6rem 0; }
code { background: #eef1f4; padding: .05rem .3rem; border-radius: 4px; }
.table-scroll { overflow-x: auto; }
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin: .7rem 0 1.1rem; }
.tab { padding: .5rem .85rem; color: var(--muted); text-decoration: none;
       border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--fg); }
.tab.active { color: var(--fg); font-weight: 600; border-bottom-color: #2563eb; }
.rec-row { display: flex; align-items: center; gap: .7rem; padding: .55rem .2rem;
           border-bottom: 1px solid var(--line); }
.rec-row .spacer { flex: 1; }
.rec-detail { padding: .6rem .8rem .9rem; background: var(--bg); border-bottom: 1px solid var(--line); }
.mform { display: flex; flex-direction: column; gap: .75rem; max-width: 460px; }
.check { display: inline-flex; align-items: center; gap: .45rem; }
.filerow { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.filepick { display: inline-flex; cursor: pointer; }
.filepick:hover .btn { background: var(--bg); }
#overlay { position: fixed; inset: 0; z-index: 100; background: rgba(247, 248, 250, .75);
           display: flex; align-items: center; justify-content: center; }
#overlay[hidden] { display: none; }
#toast { position: fixed; left: 50%; bottom: 1.4rem; transform: translateX(-50%); z-index: 120;
         max-width: 90vw; padding: .6rem 1rem; border-radius: 10px; color: #fff; font-size: .9rem;
         box-shadow: 0 8px 30px rgba(0,0,0,.18); background: var(--ok); }
#toast.error { background: var(--danger); }
#toast.info { background: var(--muted); }
#toast[hidden] { display: none; }
/* "A new version is available" — a bar, not a toast: it must not time out unnoticed.
   Mobile-first it is left-anchored with the right edge clear of the FAB column
   (right 1.1rem + 3.1rem wide) and sits above the toast; wide screens center it. */
#update-bar { position: fixed; left: .6rem; right: 5.2rem; bottom: 4.6rem; z-index: 121;
              display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
              padding: .55rem .8rem; border-radius: 10px; font-size: .9rem;
              background: #fff; border: 1px solid var(--line);
              box-shadow: 0 8px 30px rgba(0,0,0,.18); }
#update-bar[hidden] { display: none; }
#update-bar .btn.ghost { border-color: transparent; color: var(--muted); }
#overlay .busy { background: #fff; border: 1px solid var(--line); border-radius: 10px;
                 padding: 1rem 1.4rem; box-shadow: 0 8px 30px rgba(0,0,0,.12); }
/* Collapsible page sections (settings): the summary line looks like an h2. */
details.section summary { cursor: pointer; list-style: none; user-select: none;
                          font-size: 1rem; color: var(--muted); font-weight: 600;
                          margin: 1.4rem 0 .6rem; }
details.section summary::-webkit-details-marker { display: none; }
details.section summary::before { content: "▸"; display: inline-block; width: 1rem; }
details.section[open] summary::before { content: "▾"; }

.subtabs { display: flex; gap: .2rem; margin: .2rem 0 .8rem; }
.subtab { padding: .3rem .7rem; border-radius: 999px; color: var(--muted); cursor: pointer;
          text-decoration: none; font-size: .9rem; }
.subtab.active { background: #e8efff; color: #1d4ed8; font-weight: 600; }
.busy { display: flex; align-items: center; gap: .6rem; color: var(--muted); padding: .6rem 0; }
.spinner { width: 1.05rem; height: 1.05rem; border: 2px solid var(--line); border-top-color: #2563eb;
           border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Paperboy chat */
.chat-msg { padding: .5rem .75rem; border-radius: 10px; max-width: 85%; white-space: pre-wrap; }
.chat-msg.user { align-self: flex-end; background: #e8efff; }
.chat-msg.assistant { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); }

/* Floating chat button — bottom right, visible only while the dock is closed.
   Below the drawer backdrop (35) so it dims under the open mobile menu. */
.chat-fab { position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 30;
            width: 3.1rem; height: 3.1rem; border-radius: 50%; border: none;
            background: #2563eb; color: #fff; cursor: pointer;
            display: flex; align-items: center; justify-content: center;
            box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.chat-fab:hover { background: #1d4ed8; }
.chat-fab[hidden] { display: none; }

/* Global (+) activity button — stacked above the Paperboy bubble. */
.activity-fab { bottom: 5rem; background: var(--ok); font-size: 1.9rem; line-height: 1; }
.activity-fab:hover { background: #15803d; }
.fab-menu { position: fixed; right: 1.1rem; bottom: 8.6rem; z-index: 40;
            background: #fff; border: 1px solid var(--line); border-radius: 10px;
            box-shadow: 0 8px 24px rgba(0,0,0,.18); overflow: hidden;
            display: flex; flex-direction: column; }
.fab-menu button { border: none; background: none; padding: .75rem 1rem; cursor: pointer;
                   text-align: left; font: inherit; }
.fab-menu button:hover { background: var(--bg); }

/* Modal (activity capture forms) */
.modal-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.4);
                  display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-card { width: 100%; max-width: 430px; max-height: 92vh; overflow-y: auto; }

/* Fuel level meter (station detail) */
.meter { height: .65rem; border-radius: 999px; background: var(--line); overflow: hidden;
         margin: .3rem 0 .1rem; }
.meter > span { display: block; height: 100%; background: var(--ok); }
.meter.warn > span { background: var(--warn); }
.meter.danger > span { background: var(--danger); }

/* Paperboy dock — mobile: full overlay; desktop: third grid column (below). */
#dock { display: none; background: #fff; border-left: 1px solid var(--line);
        flex-direction: column; }
body.dock-open #dock { display: flex; position: fixed; inset: 49px 0 0 0; z-index: 50; }
.dock-head { display: flex; align-items: center; gap: .5rem; padding: .6rem .8rem;
             border-bottom: 1px solid var(--line); }
.dock-head .spacer { flex: 1; }
#dock-log { flex: 1; overflow-y: auto; padding: .8rem; display: flex;
            flex-direction: column; gap: .6rem; }
#dock-form { display: flex; gap: .4rem; padding: .6rem .8rem; border-top: 1px solid var(--line); }
#dock-form input { flex: 1; }

/* Desktop: sidebar becomes a static grid column; drawer chrome disappears. */
@media (min-width: 880px) {
  #hamburger { display: none; }
  .shell { display: grid; grid-template-columns: 250px 1fr; align-items: start; }
  body.dock-open .shell { grid-template-columns: 250px 1fr 340px; }
  #sidebar { position: sticky; top: 49px; height: calc(100vh - 49px);
             transform: none; z-index: 1; box-shadow: none; }
  body.dock-open #dock { position: sticky; inset: auto; top: 49px;
                         height: calc(100vh - 49px); z-index: 1; }
  #backdrop { display: none !important; }
  main { max-width: 920px; padding: 1.4rem 1.4rem; }
  /* Room to spare here — center it like the toast instead of hugging the left. */
  #update-bar { left: 50%; right: auto; transform: translateX(-50%);
                max-width: 92vw; justify-content: center; }
}
