/* Bienenstand – Design B "Flugbahn" */
@font-face { font-family: 'Baloo 2'; font-weight: 400; font-display: swap; src: url('/static/fonts/baloo-2-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Baloo 2'; font-weight: 500; font-display: swap; src: url('/static/fonts/baloo-2-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Baloo 2'; font-weight: 600; font-display: swap; src: url('/static/fonts/baloo-2-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Baloo 2'; font-weight: 700; font-display: swap; src: url('/static/fonts/baloo-2-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Baloo 2'; font-weight: 800; font-display: swap; src: url('/static/fonts/baloo-2-latin-800-normal.woff2') format('woff2'); }
@font-face { font-family: 'Baloo 2'; font-weight: 400 800; font-display: swap; src: url('/static/fonts/baloo-2-latin-ext-600-normal.woff2') format('woff2'); unicode-range: U+0100-024F, U+1E00-1EFF; }

:root {
  --bg: #EAF4FA;
  --card: #ffffff;
  --ink: #0F2A3D;
  --muted: #47667B;
  --line: #C9DDEA;
  --track: #DCEAF3;
  --blue: #1D5F86;
  --honey: #F2B21B;
  --honey-soft: #FFF3CC;
  --honey-ink: #7A5700;
  --strike: #B8431C;
  --strike-soft: #FBE3DA;
  --ok: #1F7A4D;
  --radius: 18px;
  --name-w: 150px;
  font-family: 'Baloo 2', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); }
body { font-size: 18px; line-height: 1.35; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--blue); }
a:hover { color: var(--ink); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout ---------- */
.wrap { max-width: 1280px; margin: 0 auto; padding: 24px 32px 48px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.spacer { flex: 1 1 auto; }

/* ---------- Top navigation ---------- */
.nav { background: var(--ink); color: #fff; }
.nav-inner { max-width: 1280px; margin: 0 auto; padding: 8px 32px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 22px; margin-right: 16px; color: #fff; text-decoration: none; }
.brand svg { width: 34px; height: 34px; }
.nav a.nav-link, .nav button.nav-link { color: #D7E7F1; text-decoration: none; padding: 8px 14px; border-radius: 10px; font-weight: 600; background: none; border: 0; cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; }
.nav a.nav-link:hover, .nav button.nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.nav-link[aria-current="page"] { background: #fff; color: var(--ink); }
.nav .who { color: #A9C3D3; font-size: 15px; margin-left: auto; padding: 0 8px; }

/* ---------- Headings ---------- */
h1 { margin: 0; font-size: 40px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.1; }
h2 { margin: 0; font-size: 26px; font-weight: 800; }
h3 { margin: 0; font-size: 20px; font-weight: 700; }
.sub { color: var(--muted); font-size: 18px; font-weight: 600; }
.hint { color: var(--muted); font-size: 15px; }

/* ---------- Controls ---------- */
.field { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 14px; padding: 0 14px; min-height: 48px; box-shadow: inset 0 0 0 2px var(--line); }
.field:focus-within { box-shadow: inset 0 0 0 2px var(--blue); }
.field input, .field select { border: 0; outline: 0; background: transparent; font-size: 18px; min-height: 44px; min-width: 0; }
.field input { width: 170px; }
.field svg { flex: none; }
.field .lbl { font-weight: 600; color: var(--muted); font-size: 16px; }

.form { display: flex; flex-direction: column; gap: 14px; }
.form label.block { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.form input[type=text], .form input[type=password], .form input[type=search], .form select, .input {
  border: 0; outline: 0; background: var(--card); border-radius: 12px; padding: 10px 14px; min-height: 48px; font-size: 18px;
  box-shadow: inset 0 0 0 2px var(--line); width: 100%;
}
.form input:focus, .input:focus, .form select:focus { box-shadow: inset 0 0 0 2px var(--blue); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 14px; border: 0; cursor: pointer; font-weight: 700; font-size: 17px; background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); text-decoration: none; }
.btn:hover { box-shadow: inset 0 0 0 2px var(--blue); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: #fff; box-shadow: none; }
.btn-primary:hover { background: #1B4360; box-shadow: none; }
.btn-honey { background: var(--honey); color: var(--ink); box-shadow: none; }
.btn-honey:hover { background: #E3A20A; box-shadow: none; }
.btn-strike { background: var(--strike); color: #fff; box-shadow: none; }
.btn-strike:hover { background: #9C3614; box-shadow: none; }
.btn-danger { color: var(--strike); }
.btn-danger:hover { box-shadow: inset 0 0 0 2px var(--strike); }
.btn-sm { min-height: 44px; padding: 0 14px; font-size: 15px; border-radius: 12px; }
.icon-btn { width: 48px; padding: 0; }

.seg { display: inline-flex; background: #D5E6F0; padding: 4px; border-radius: 14px; gap: 2px; }
.seg button { min-height: 42px; padding: 0 16px; border: 0; border-radius: 10px; background: transparent; font-weight: 600; cursor: pointer; font-size: 16px; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }

.card { background: var(--card); border-radius: var(--radius); padding: 22px 24px; }
.empty { background: var(--card); border-radius: var(--radius); padding: 40px 24px; text-align: center; color: var(--muted); font-size: 20px; font-weight: 600; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 14px; font-weight: 600; z-index: 100; box-shadow: 0 8px 24px rgba(15,42,61,.25); max-width: calc(100% - 32px); }
.toast.err { background: var(--strike); }

/* ---------- Dialog ---------- */
dialog { border: 0; border-radius: 22px; padding: 26px; width: min(460px, calc(100% - 32px)); color: var(--ink); background: var(--bg); }
dialog::backdrop { background: rgba(15,42,61,.45); }
dialog .actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }

/* ============================================================
   VISU (Kinderansicht)
   ============================================================ */
.visu .wrap { max-width: 1400px; display: flex; flex-direction: column; gap: 16px; }
.visu-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; }
.visu-head .titles { display: flex; flex-direction: column; gap: 2px; }
.scale, .kid-row { display: grid; grid-template-columns: var(--name-w) minmax(0, 1fr); gap: 20px; align-items: center; }
.scale { padding: 0 34px 0 20px; }
.ticks { position: relative; height: 32px; }
.tick { position: absolute; transform: translateX(-50%); font-size: 18px; font-weight: 800; color: var(--honey-ink); }
.tick.neg { color: var(--strike); }
.tick.zero { color: var(--ink); }

.kid-list { display: flex; flex-direction: column; gap: 10px; }
.kid-row { background: var(--card); border-radius: 20px; padding: 10px 34px 10px 20px; min-height: 80px; transition: background .3s; }
.kid-row.goal { background: #FFF6D6; box-shadow: inset 0 0 0 3px var(--honey); }
.kid-row.limit { background: #FFF0EA; box-shadow: inset 0 0 0 3px var(--strike); }
.kid-name { font-size: 26px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kid-name small { display: block; font-size: 15px; font-weight: 700; line-height: 1; }
.kid-row.goal .kid-name small { color: var(--honey-ink); }
.kid-row.limit .kid-name small { color: var(--strike); }

.track { position: relative; height: 60px; }
.track .rail { position: absolute; left: 0; right: 0; top: 26px; height: 8px; border-radius: 4px; background: var(--track); }
.track .rail-neg { position: absolute; left: 0; width: 33.333%; top: 26px; height: 8px; border-radius: 4px 0 0 4px; background: repeating-linear-gradient(90deg, #F5CDBF 0 6px, var(--track) 6px 10px); }
.track .seg-fill { position: absolute; top: 24px; height: 12px; border-radius: 6px; transition: left .5s ease, width .5s ease; }
.track .seg-fill.pos { background: var(--honey); }
.track .seg-fill.neg { background: #D2522B; }
.track .zero { position: absolute; left: 33.333%; top: 14px; width: 4px; height: 32px; margin-left: -2px; border-radius: 2px; background: var(--ink); }
.track .goal-star, .track .limit-mark { position: absolute; top: 12px; width: 36px; height: 36px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; }
.track .goal-star { right: -18px; box-shadow: inset 0 0 0 3px var(--honey); }
.track .limit-mark { left: -18px; box-shadow: inset 0 0 0 3px var(--strike); }
.track .marker { position: absolute; top: 0; transform: translateX(-50%); transition: left .5s ease; z-index: 2; }
.marker.bee { width: 60px; height: 60px; border-radius: 50%; background: var(--honey-soft); box-shadow: 0 0 0 3px #fff, 0 4px 10px rgba(15,42,61,.18); display: flex; align-items: center; justify-content: center; }
.marker.bee svg { width: 44px; height: 44px; }
.marker.strikes { top: 4px; min-width: 52px; height: 52px; padding: 0 9px; border-radius: 14px; background: var(--strike); display: flex; align-items: center; justify-content: center; gap: 4px; box-shadow: 0 0 0 3px #fff; }
.marker.strikes i { width: 4px; height: 26px; border-radius: 2px; background: #fff; transform: rotate(14deg); }
.marker.zero-dot { top: 8px; width: 44px; height: 44px; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 3px var(--ink); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; }
.kid-row.goal .marker.bee { animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -5px); } }
@media (prefers-reduced-motion: reduce) { .kid-row.goal .marker.bee { animation: none; } .track .marker, .track .seg-fill { transition: none; } }

.legend { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 18px; font-weight: 600; color: var(--blue); padding-left: calc(var(--name-w) + 40px); }

/* ============================================================
   LEITER
   ============================================================ */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.l-list { display: flex; flex-direction: column; gap: 10px; }
.l-row { background: var(--card); border-radius: 18px; padding: 12px 16px 12px 20px; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px 16px; align-items: center; }
.l-who { display: flex; flex-direction: column; min-width: 0; }
.l-name { font-size: 24px; font-weight: 700; display: flex; align-items: center; gap: 10px; min-width: 0; }
.l-name span.n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: #E3EEF5; color: var(--blue); flex: none; }
.counts { font-size: 15px; color: var(--muted); font-weight: 600; display: flex; gap: 14px; flex-wrap: wrap; }
.counts b { color: var(--ink); }
.l-ctrl { display: flex; align-items: center; gap: 10px; }
.val { min-width: 76px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 800; background: #EEF3F7; }
.val.pos { background: var(--honey-soft); color: var(--honey-ink); }
.val.neg { background: var(--strike-soft); color: var(--strike); }
.pm { width: 56px; height: 56px; border-radius: 16px; border: 0; cursor: pointer; font-size: 32px; font-weight: 800; display: flex; align-items: center; justify-content: center; line-height: 1; }
.pm.minus { background: var(--strike-soft); color: var(--strike); }
.pm.plus { background: var(--honey); color: var(--ink); }
.pm:hover { filter: brightness(.95); }
.pm:disabled { opacity: .35; cursor: not-allowed; }
.l-extra { display: flex; gap: 8px; align-items: center; justify-content: flex-end; min-width: 230px; }

/* ============================================================
   ADMIN / PROTOKOLL
   ============================================================ */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 16px; }
th { text-align: left; font-size: 14px; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 2px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid #E3EEF5; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td .row { gap: 6px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; cursor: pointer; font-weight: 600; }
.checks input { width: 20px; height: 20px; accent-color: var(--ink); }
.linkbox { display: flex; gap: 8px; flex-wrap: wrap; background: var(--honey-soft); border-radius: 14px; padding: 12px; }
.linkbox input { flex: 1 1 260px; }
.act { font-weight: 700; white-space: nowrap; }
.act.plus { color: var(--honey-ink); }
.act.minus, .act.punishment_done { color: var(--strike); }
.act.reward_done { color: var(--ok); }
.muted { color: var(--muted); }
.pill { display: inline-block; font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: #E3EEF5; color: var(--blue); }
.pill.off { background: var(--strike-soft); color: var(--strike); }

/* ---------- Auth pages ---------- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth .card { width: min(440px, 100%); padding: 32px; display: flex; flex-direction: column; gap: 18px; }
.auth .logo { display: flex; align-items: center; gap: 10px; font-size: 30px; font-weight: 800; }
.auth .logo svg { width: 48px; height: 48px; }
.err-box { background: var(--strike-soft); color: var(--strike); border-radius: 12px; padding: 10px 14px; font-weight: 600; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  :root { --name-w: 110px; }
  .wrap { padding: 16px 16px 40px; }
  .nav-inner { padding: 6px 16px; }
  h1 { font-size: 30px; }
  .kid-name { font-size: 21px; }
  .tick { font-size: 15px; }
}
@media (max-width: 640px) {
  :root { --name-w: 76px; }
  .scale, .kid-row { gap: 10px; }
  .kid-row { padding: 8px 28px 8px 12px; min-height: 64px; }
  .scale { padding: 0 28px 0 12px; }
  .kid-name { font-size: 17px; }
  .track { height: 48px; }
  .track .rail, .track .rail-neg { top: 20px; }
  .track .seg-fill { top: 18px; }
  .track .zero { top: 10px; height: 28px; }
  .track .goal-star, .track .limit-mark { width: 28px; height: 28px; top: 10px; }
  .track .goal-star { right: -14px; } .track .limit-mark { left: -14px; }
  .marker.bee { width: 44px; height: 44px; } .marker.bee svg { width: 32px; height: 32px; }
  .marker.strikes { height: 40px; min-width: 40px; padding: 0 6px; gap: 3px; } .marker.strikes i { height: 20px; width: 3px; }
  .marker.zero-dot { width: 34px; height: 34px; font-size: 16px; top: 7px; }
  .tick { font-size: 12px; }
  .legend { padding-left: 0; font-size: 15px; }
  .field input { width: 120px; }
  .l-row { grid-template-columns: minmax(0, 1fr) auto; }
  .l-extra { grid-column: 1 / -1; min-width: 0; }
  .l-name { font-size: 20px; }
}
.m0 { margin: 0; }
