:root {
  --bg: #111317;
  --bg2: #171a20;
  --card: #1c2028;
  --line: #2a303b;
  --text: #eceef2;
  --muted: #9aa3b2;
  --accent: #ff7a1a;
  --accent2: #ffb347;
  --ok: #3ecf8e;
  --err: #ff5a5f;
  --radius: 16px;
  --tabbar: 64px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(255, 122, 26, .12), transparent 60%),
    radial-gradient(700px 400px at -10% 110%, rgba(255, 179, 71, .06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: .2rem 0; line-height: 1.2; }
h2 { font-size: 1.1rem; margin: 1.6rem 0 .7rem; color: var(--muted); font-weight: 600; }
h3 { font-size: 1.05rem; margin: 1rem 0 .3rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.ico { width: 1.15em; height: 1.15em; vertical-align: -.2em; flex: none; }

/* Kopf und Navigation */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1rem;
  padding: .7rem 1.2rem; padding-top: max(.7rem, env(safe-area-inset-top));
  background: rgba(17, 19, 23, .82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .55rem; color: var(--text); font-weight: 700; font-size: 1.1rem; }
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; }
.tabbar { margin-left: auto; display: flex; gap: .3rem; }
.tabbar a {
  display: flex; align-items: center; gap: .45rem; padding: .5rem .85rem; border-radius: 999px;
  color: var(--muted); font-weight: 500; transition: background .2s, color .2s;
}
.tabbar a:hover { text-decoration: none; color: var(--text); background: var(--card); }
.tabbar a.on { color: #1a0f05; background: linear-gradient(135deg, var(--accent), var(--accent2)); }

.wrap { max-width: 980px; margin: 0 auto; padding: 1.2rem 1rem 2rem; animation: rein .35s ease; }
@keyframes rein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.foot { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 3rem; }

@media (max-width: 700px) {
  .wrap { padding-bottom: calc(var(--tabbar) + 2rem + env(safe-area-inset-bottom)); }
  /* backdrop-filter würde die feste Leiste unten an den Kopf binden */
  .top { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(17, 19, 23, .97); }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; margin: 0; gap: 0;
    padding: .35rem .4rem calc(.35rem + env(safe-area-inset-bottom));
    background: rgba(23, 26, 32, .94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line); justify-content: space-around;
  }
  .tabbar a { flex-direction: column; gap: .1rem; font-size: .7rem; padding: .35rem .5rem; border-radius: 12px; flex: 1; }
  .tabbar a .ico { width: 1.45em; height: 1.45em; }
  .tabbar a.on { background: none; color: var(--accent); }
  h1 { font-size: 1.4rem; }
}

/* Karten und Raster */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,.025), transparent), var(--card);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.1rem; margin-bottom: 1rem;
}
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.grid .card { margin: 0; }
.hello { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.back { display: inline-block; margin-bottom: .4rem; color: var(--muted); }
.empty { text-align: center; padding: 1.8rem 1rem; }
.empty p { margin: 0 0 1rem; color: var(--muted); }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: .7rem; margin-bottom: .5rem; }
@media (max-width: 560px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
.tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem;
  display: flex; flex-direction: column; color: var(--text);
}
a.tile:hover { text-decoration: none; border-color: var(--accent); }
.tile b { font-size: 1.6rem; line-height: 1.1; }
.tile span { color: var(--muted); font-size: .85rem; }

/* Durchgang-Karte */
.run { display: flex; flex-direction: column; gap: .7rem; }
.run-aktiv { border-color: rgba(255, 122, 26, .45); box-shadow: 0 0 0 1px rgba(255, 122, 26, .12), 0 10px 30px -18px rgba(255, 122, 26, .6); }
.run-head { display: flex; justify-content: space-between; gap: .6rem; color: var(--text); }
.run-head:hover { text-decoration: none; }
.run-head h3 { margin: 0; }
.badge {
  align-self: flex-start; font-size: .75rem; padding: .15rem .6rem; border-radius: 999px;
  background: var(--bg2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.badge-on { color: var(--accent); border-color: rgba(255, 122, 26, .5); background: rgba(255, 122, 26, .1); }
.badge-on::before {
  content: ""; display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; background: var(--accent);
  margin-right: .35rem; vertical-align: .05rem; animation: puls 1.6s infinite;
}
@keyframes puls { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

.stats { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; }
.stats div { display: flex; flex-direction: column; }
.stats b { font-size: 1.25rem; line-height: 1.2; }
.stats b small { color: var(--muted); font-weight: 500; font-size: .85rem; }
.stats span { color: var(--muted); font-size: .78rem; }
.stats-big b { font-size: 1.7rem; }
.stars { color: var(--accent2); letter-spacing: .05em; }
.bar { height: 6px; background: var(--bg2); border-radius: 99px; overflow: hidden; margin: .7rem 0 .2rem; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 99px; transition: width .4s; }

/* Countdown */
.countdown {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .1rem 1rem;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: .9rem 1.1rem; margin-bottom: .8rem;
}
.cd-label { color: var(--muted); display: flex; gap: .4rem; align-items: center; font-size: .9rem; }
.cd-time { grid-row: span 2; font-variant-numeric: tabular-nums; font-size: 2.4rem; font-weight: 700; letter-spacing: .02em; }
.cd-at { color: var(--muted); font-size: .8rem; }
.countdown-sm { margin: 0; padding: .6rem .9rem; }
.countdown-sm .cd-time { font-size: 1.6rem; }
.countdown.warn .cd-time { color: var(--accent2); }
.countdown.done { border-color: var(--accent); background: rgba(255, 122, 26, .12); animation: blink 1s infinite; }
.countdown.done .cd-time { color: var(--accent); }
@keyframes blink { 50% { background: rgba(255, 122, 26, .25); } }

/* Formulare */
.form { display: flex; flex-direction: column; gap: .8rem; }
label { display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; color: var(--muted); flex: 1; min-width: 0; }
input, select, textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--text);
  background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: .7rem .8rem;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 122, 26, .2); }
textarea { resize: vertical; }
input[type="checkbox"] { width: 1.2rem; height: 1.2rem; accent-color: var(--accent); }
label.check { flex-direction: row; align-items: center; gap: .55rem; color: var(--text); font-size: .95rem; }
.row { display: flex; gap: .8rem; }
@media (max-width: 560px) { .row { flex-direction: column; } }
.inline { display: flex; gap: .5rem; align-items: center; }
.inline input { flex: 1; }
.search { margin-bottom: 1rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  font: inherit; font-weight: 600; color: #1a0f05; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: 0; border-radius: 12px; padding: .65rem 1.1rem; white-space: nowrap;
  transition: transform .1s, filter .2s;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn-big { width: 100%; padding: .95rem 1.2rem; font-size: 1.08rem; }
.btn-ghost { background: var(--bg2); color: var(--text); border: 1px solid var(--line); }
.btn-danger { background: transparent; color: var(--err); border: 1px solid rgba(255, 90, 95, .45); }
.btn-smoke { width: 100%; }
.btn-smoke.btn-big { font-size: 1.2rem; padding: 1.1rem; }
.row-btn { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: .6rem 0; }
.row-btn form { margin: 0; }
.row-btn.end { justify-content: flex-end; }
.smoke-form { display: flex; flex-direction: column; gap: .6rem; margin-top: .9rem; }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  font: inherit; font-size: .92rem; cursor: pointer; color: var(--text);
  background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; padding: .45rem .95rem;
}
.chip:hover { border-color: var(--accent); }
.chip-on { border-color: var(--accent); color: var(--accent); }
.h-card { margin: 0 0 .8rem; color: var(--text); display: flex; align-items: center; gap: .45rem; }

/* Aufklappbereiche */
details.fold > summary, .fold-inline > summary, details.user > summary {
  cursor: pointer; list-style: none; font-weight: 600; display: flex; align-items: center; gap: .5rem;
}
details > summary::-webkit-details-marker { display: none; }
details.fold > summary::after, .fold-inline > summary::after { content: "›"; margin-left: auto; transition: transform .2s; font-size: 1.3rem; color: var(--muted); }
details[open].fold > summary::after, .fold-inline[open] > summary::after { transform: rotate(90deg); }
details.fold[open] > summary { margin-bottom: 1rem; }
.fold-inline { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .8rem; }
.fold-inline > summary { color: var(--accent2); font-weight: 500; }
.fold-inline[open] > summary { margin-bottom: .8rem; }

/* Rauchgaben-Liste */
.day + .day { margin-top: 1rem; }
.day-head { margin-bottom: .3rem; }
.smokes { list-style: none; margin: 0; padding: 0; }
.smokes li { display: flex; align-items: center; gap: .8rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.smokes li:last-child { border-bottom: 0; }
.smokes .nr { color: var(--accent); font-weight: 700; min-width: 2.6rem; font-variant-numeric: tabular-nums; }
.smokes .t { font-variant-numeric: tabular-nums; }
.smokes .n { color: var(--muted); flex: 1; font-size: .9rem; }
.smokes form { margin: 0 0 0 auto; }
.x { background: none; border: 0; color: var(--muted); font-size: 1.3rem; cursor: pointer; padding: 0 .3rem; line-height: 1; }
.x:hover { color: var(--err); }

.tabs { display: flex; gap: .4rem; margin: 1.2rem 0 1rem; }
.tabs a { padding: .4rem .95rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); background: var(--card); }
.tabs a.on { color: var(--accent); border-color: var(--accent); }
.tabs a:hover { text-decoration: none; }

/* Rezepte */
.recipe { color: var(--text); transition: border-color .2s, transform .2s; }
.recipe:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); }
.recipe h3 { margin: 0; }
.tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .7rem; }
.tags span { font-size: .78rem; background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; padding: .1rem .6rem; color: var(--muted); }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .8rem; }
.facts div { background: var(--bg2); border-radius: 12px; padding: .6rem .8rem; display: flex; flex-direction: column; }
.facts span { color: var(--muted); font-size: .78rem; }
.pre { white-space: pre-wrap; margin: .2rem 0 .6rem; }

/* Einstellungen */
.steps { padding-left: 1.2rem; margin: .4rem 0 .8rem; }
.steps li { margin-bottom: .3rem; }
.code { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; word-break: break-all; user-select: all; }
.users { margin-bottom: 1rem; }
details.user { border-bottom: 1px solid var(--line); padding: .6rem 0; }
details.user[open] > summary { margin-bottom: .6rem; }
details.user form { margin: .4rem 0; }

/* Meldungen */
.flash { border-radius: 12px; padding: .75rem 1rem; margin-bottom: 1rem; border: 1px solid; animation: rein .3s ease; }
.flash-ok { background: rgba(62, 207, 142, .1); border-color: rgba(62, 207, 142, .4); color: #b7f0d6; }
.flash-err { background: rgba(255, 90, 95, .1); border-color: rgba(255, 90, 95, .45); color: #ffc9cb; }

/* Login */
.login { max-width: 400px; margin: 6vh auto 0; text-align: center; }
.login .form { text-align: left; margin-top: 1.2rem; }
.login-logo img { width: 84px; height: 84px; filter: drop-shadow(0 8px 24px rgba(255, 122, 26, .45)); animation: schweb 4s ease-in-out infinite; }
@keyframes schweb { 50% { transform: translateY(-6px); } }

/* Alarm */
.alarm {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  background: rgba(10, 8, 6, .82); backdrop-filter: blur(6px); padding: 1.5rem;
}
.alarm[hidden] { display: none; }
.alarm-box { background: var(--card); border: 1px solid var(--accent); border-radius: 22px; padding: 1.6rem; text-align: center; max-width: 360px; width: 100%; }
.alarm-ico .ico { width: 64px; height: 64px; color: var(--accent); animation: puls .8s infinite; }
.alarm-title { font-size: 1.5rem; font-weight: 700; margin: .4rem 0; }
.alarm-text { color: var(--muted); margin-bottom: 1.2rem; }

/* Orga-Dashboard */
.status { display: flex; flex-wrap: wrap; gap: .5rem; margin: .4rem 0 1.2rem; }
.pill { font-size: .8rem; padding: .25rem .75rem; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--muted); }
.pill-ok { color: var(--ok); border-color: rgba(62, 207, 142, .4); }
.pill-warn { color: var(--accent2); border-color: rgba(255, 179, 71, .45); }
.pill-err { color: var(--err); border-color: rgba(255, 90, 95, .45); }
.drop {
  position: relative; align-items: center; justify-content: center; text-align: center; gap: .2rem;
  border: 2px dashed var(--line); border-radius: 14px; padding: 1.4rem 1rem; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: rgba(255, 122, 26, .06); }
.drop.voll { border-style: solid; border-color: var(--accent); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-text { color: var(--text); font-weight: 600; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn-sm { padding: .35rem .7rem; font-size: .85rem; }
.list { list-style: none; padding: 0; margin: .4rem 0 .6rem; }
.list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .3rem .8rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.list li .row-btn { margin: 0; gap: .4rem; }
.log + .log { margin-top: .9rem; }
.log ul { margin: .3rem 0 0; padding-left: 1.2rem; color: var(--muted); }
.link-card { display: flex; flex-direction: column; color: var(--text); transition: border-color .2s; }
.link-card:hover { text-decoration: none; border-color: var(--accent); }
@media (max-width: 700px) { .tabbar a { padding: .35rem .2rem; font-size: .66rem; } }
