/* ---- Buttons ----------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 650;
  font-size: 16px;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: transform .12s var(--ease), background-color .15s, border-color .15s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--ghost { background: var(--surface-2); border-color: var(--line); color: var(--text); }
.btn--ghost:hover { border-color: var(--line-strong); }
.btn--danger { background: var(--bad-soft); color: var(--bad); }
.btn--small { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn--block { width: 100%; }

.iconbtn {
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--text-2);
  cursor: pointer;
  transition: background-color .15s, color .15s, transform .12s var(--ease);
}
.iconbtn:hover { background: var(--surface-2); color: var(--text); }
.iconbtn:active { transform: scale(.94); }
.iconbtn.is-on { color: var(--accent); }
.iconbtn.is-on svg { fill: currentColor; }
.iconbtn--small { width: 36px; height: 36px; border-radius: 10px; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions--end { justify-content: flex-end; }
.actions > .btn { flex: 1 1 auto; }

/* ---- Karten und Abstände ---------------------------------------------- */

.stack > * + * { margin-top: 12px; }
.stack--l > * + * { margin-top: 20px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.card__title, .section-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-3);
}
.card__title { margin-bottom: 12px; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card__head .card__title { margin: 0; }
.section-label { margin: 26px 2px 10px; }

.hero {
  padding: 18px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.hero__label { font-size: 13px; color: var(--text-2); font-weight: 550; }
.hero__value {
  margin-top: 2px;
  font-size: clamp(30px, 9.5vw, 42px);
  font-weight: 720;
  letter-spacing: -.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.hero__sub { margin-top: 6px; font-size: 14px; color: var(--text-2); }
.hero--text .hero__value { font-size: clamp(22px, 6.6vw, 28px); letter-spacing: -.01em; line-height: 1.2; }
.hero--accent { background: var(--accent-soft); border-color: var(--accent-line); }
.hero--ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.hero--bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }

/* ---- Felder ------------------------------------------------------------ */

.fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 12px;
  align-items: start;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field--full { grid-column: 1 / -1; }
.field__label { font-size: 13px; font-weight: 550; color: var(--text-2); }
.field__box {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 12px;
  background: var(--field);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  transition: border-color .15s, box-shadow .15s;
}
.field__box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field__box input,
.field__box select,
.field__box textarea {
  flex: 1;
  width: 100%;
  min-width: 0;
  padding: 11px 0;
  border: 0;
  outline: 0;
  background: none;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}
.field__box textarea { min-height: 96px; resize: vertical; line-height: 1.4; font-size: 15.5px; }
.field__box select { cursor: pointer; }
.field__box select option { background: var(--surface); color: var(--text); }
.field__box input::placeholder, .field__box textarea::placeholder { color: var(--text-3); opacity: 1; }
.field__box input[type="date"] { min-height: 24px; }
.field__unit { padding-left: 8px; font-size: 14px; color: var(--text-3); white-space: nowrap; }
.field__hint { font-size: 12.5px; color: var(--text-3); }
.field__value { margin-left: 8px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.field.is-invalid .field__box { border-color: var(--bad); }
.field--mono input, .field--mono textarea { font-family: var(--font-mono); font-size: 14.5px; }

.form-error { min-height: 20px; font-size: 14px; color: var(--bad); }
.form-error:empty { display: none; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--tap); cursor: pointer; }
.switch__text { font-size: 15.5px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track {
  flex: none;
  width: 46px;
  height: 28px;
  padding: 3px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background-color .18s;
}
.switch__track::after {
  content: "";
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
  transition: transform .18s var(--ease);
}
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--accent); outline-offset: 2px; }

.seg {
  position: relative;
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border-radius: 13px;
  overflow-x: auto;
  scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg--wrap { flex-wrap: wrap; overflow: visible; }
.seg--wrap .seg__btn { flex: 1 1 auto; }
.seg__btn {
  flex: 1 0 auto;
  min-height: 40px;
  padding: 0 13px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--text-2);
  font-size: 14.5px;
  font-weight: 620;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.seg__btn[aria-selected="true"], .seg__btn[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-seg); }
:root[data-theme="dark"] .seg__btn[aria-selected="true"], :root[data-theme="dark"] .seg__btn[aria-pressed="true"] { background: #34322F; }

input[type="range"] { width: 100%; accent-color: var(--accent); height: 28px; }

/* ---- Ergebnisse -------------------------------------------------------- */

.results { margin: 0; }
.results__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.results__row:first-child { padding-top: 0; }
.results__row:last-child { padding-bottom: 0; border-bottom: 0; }
.results dt { font-size: 14.5px; color: var(--text-2); }
.results dd { margin: 0; text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.results__row--big dd { font-size: 26px; font-weight: 720; letter-spacing: -.015em; line-height: 1.15; }
.results__sub { display: block; font-size: 12.5px; font-weight: 450; color: var(--text-3); }
.results__row.is-copyable { cursor: copy; }

.tone-ok { color: var(--ok); }
.tone-warn { color: var(--warn); }
.tone-bad { color: var(--bad); }
.tone-accent { color: var(--accent); }
.tone-muted { color: var(--text-3); }

.note { font-size: 13.5px; line-height: 1.45; color: var(--text-2); }
.note--small { font-size: 12.5px; color: var(--text-3); }

.callout {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-2);
}
.callout svg { margin-top: 1px; color: var(--text-3); }
.callout--warn { background: var(--warn-soft); color: var(--text); }
.callout--warn svg { color: var(--warn); }
.callout--bad { background: var(--bad-soft); color: var(--text); }
.callout--bad svg { color: var(--bad); }
.callout--ok { background: var(--ok-soft); color: var(--text); }
.callout--ok svg { color: var(--ok); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}
.chip--ok { background: var(--ok-soft); color: var(--ok); }
.chip--warn { background: var(--warn-soft); color: var(--warn); }
.chip--bad { background: var(--bad-soft); color: var(--bad); }
.chip--accent { background: var(--accent-soft); color: var(--accent); }

.bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .3s var(--ease); }
.bar--ok > i { background: var(--ok); }
.bar--bad > i { background: var(--bad); }

/* ---- Listen und Tabellen ---------------------------------------------- */

.list { list-style: none; margin: 0; padding: 0; }
.list__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.list__item:first-child { padding-top: 0; }
.list__item:last-child { padding-bottom: 0; border-bottom: 0; }
.list__item--tap { cursor: pointer; }
.list__main { flex: 1; min-width: 0; }
.list__title { font-weight: 620; line-height: 1.3; }
.list__sub { margin-top: 2px; font-size: 13px; color: var(--text-3); line-height: 1.35; }
.list__value { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.list__value small { display: block; font-size: 12.5px; font-weight: 450; color: var(--text-3); }

.list-heading { margin: 18px 0 8px; font-size: 13px; font-weight: 650; color: var(--text-2); }
.list-heading:first-child { margin-top: 0; }

.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14.5px; }
.table th {
  padding: 8px 8px 8px 0;
  text-align: left;
  font-size: 12px;
  font-weight: 650;
  color: var(--text-3);
  border-bottom: 1px solid var(--line-strong);
  vertical-align: bottom;
}
.table td { padding: 9px 8px 9px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; padding-right: 0; padding-left: 8px; white-space: nowrap; }
.table tr.is-strong td { font-weight: 700; }
.table tr.is-muted td { color: var(--text-3); }

.empty { padding: 28px 12px; text-align: center; color: var(--text-2); }
.empty__title { font-weight: 650; color: var(--text); margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

/* ---- Startseite -------------------------------------------------------- */

.home-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--tap); margin-bottom: 20px; }

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 54px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  color: var(--text-3);
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: none;
  color: var(--text);
  font-size: 17px;
}
.search input::placeholder { color: var(--text-3); opacity: 1; }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd {
  padding: 2px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font: 12px var(--font-mono);
  color: var(--text-3);
}

.examples { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.example {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--text-2);
  font: 13px var(--font-mono);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.example:hover { border-color: var(--accent-line); color: var(--text); }

.quick-list { display: grid; gap: 8px; margin-top: 10px; }
.quick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  text-decoration: none;
  cursor: pointer;
}
.quick__label { font-size: 13px; color: var(--text-2); }
.quick__value { font-size: 21px; font-weight: 720; letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.quick__go { color: var(--accent); }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 600px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 108px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  transition: transform .12s var(--ease), border-color .15s, background-color .15s;
}
.tile:hover { border-color: var(--line-strong); background: var(--surface-2); }
.tile:active { transform: scale(.98); }
.tile__icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  transition: background-color .15s, color .15s;
}
.tile:hover .tile__icon { background: var(--accent); color: var(--accent-ink); }
.tile__title { font-size: 15px; font-weight: 650; line-height: 1.25; }
.tile__sub {
  margin-top: -6px;
  font-size: 12.5px;
  line-height: 1.32;
  color: var(--text-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tile__badge { position: absolute; top: 12px; right: 12px; color: var(--text-3); }
.tile.is-first { border-color: var(--accent-line); }

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12.5px;
  font-weight: 650;
}

/* ---- Seitenleiste (Desktop) ------------------------------------------- */

.sidebar__head { padding: 2px 10px 22px; }
.nav__label { margin: 14px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.nav__link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  color: var(--text-2);
  font-size: 14.5px;
  text-decoration: none;
  transition: background-color .12s, color .12s;
}
.nav__link:hover { background: var(--surface-2); color: var(--text); }
.nav__link[aria-current="page"] { background: var(--surface-2); color: var(--text); font-weight: 620; box-shadow: inset 2px 0 0 var(--accent); }
.nav__link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__foot { margin-top: auto; padding-top: 14px; }

/* ---- Anmeldung --------------------------------------------------------- */

.login {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
}
.login__box { width: 100%; max-width: 380px; }
.login__mark { margin-bottom: 34px; }
.login__mark .wordmark { font-size: 44px; }
.login__text { margin-bottom: 18px; color: var(--text-2); }
.login__error { min-height: 22px; margin-top: 10px; font-size: 14px; color: var(--bad); }

/* ---- Dialoge und Hinweise --------------------------------------------- */

dialog.sheet {
  width: min(560px, 100vw);
  max-width: 100vw;
  max-height: 92dvh;
  margin: auto auto 0;
  padding: 0;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}
dialog.sheet[open] { display: flex; flex-direction: column; animation: sheet-up .24s var(--ease); }
dialog.sheet::backdrop { background: rgba(0, 0, 0, .58); }
@media (min-width: 640px) {
  dialog.sheet { margin: auto; border-bottom: 1px solid var(--line); border-radius: 20px; }
  dialog.sheet[open] { animation-name: rise; }
}
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 8px 4px 18px; }
.sheet__title { font-size: 18px; font-weight: 700; }
.sheet__body { padding: 8px 18px calc(18px + env(safe-area-inset-bottom)); overflow-y: auto; }

.toasts {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 480px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  font-size: 14.5px;
  font-weight: 620;
  box-shadow: var(--shadow-pop);
  pointer-events: auto;
  animation: rise .2s var(--ease) both;
}
.toast--bad { background: var(--bad); color: #1a0806; }
.toast button { border: 0; background: none; color: inherit; font-weight: 750; text-decoration: underline; cursor: pointer; padding: 4px; }

.mono { font-family: var(--font-mono); font-size: .93em; }
.muted { color: var(--text-2); }
.right { text-align: right; }
.row { display: flex; align-items: center; gap: 10px; }
.row--between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
