/* Essensgeld zurück – mobile first.
   Idee: ruhige Formularoberfläche, ein einziges auffälliges Element –
   der Kassenbon unten im Formular, der die Summe live mitschreibt. */
:root {
  --paper: #F4F7F6;
  --surface: #FFFFFF;
  --ink: #1D2B36;
  --ink-soft: #52616B;
  --line: #D3DDDA;
  --pine: #1F6F5C;
  --crayon: #FFC83D;
  --crayon-deep: #E5A800;
  --tomato: #B8391F;
  --radius-s: 6px;
  --radius-l: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 17px/1.55 var(--font);
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--pine); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--crayon-deep); outline-offset: 2px; }
h1 { font-size: 1.75rem; line-height: 1.15; letter-spacing: -0.02em; margin: 0.4em 0 0.5em; font-weight: 750; }
h2 { font-size: 1.2rem; margin: 1.6em 0 0.5em; font-weight: 700; }
.lead { font-size: 1.05rem; }
.muted, small { color: var(--ink-soft); }
small { font-size: 0.85rem; }
.wrap { max-width: 44rem; margin: 0 auto; padding: 0 1rem 2rem; }

/* Kopfzeile */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(0.6rem + env(safe-area-inset-top)) 1rem 0.6rem;
  background: var(--ink); color: #fff;
}
.brand { color: #fff; font-weight: 750; text-decoration: none; letter-spacing: -0.01em; }
.menu summary { list-style: none; cursor: pointer; padding: 0.4rem 0.8rem; border: 1px solid #ffffff55; border-radius: var(--radius-s); }
.menu summary::-webkit-details-marker { display: none; }
.menu nav {
  position: absolute; right: 0.75rem; top: calc(100% + 0.25rem); min-width: 15rem;
  background: var(--surface); border-radius: var(--radius-l); padding: 0.5rem;
  box-shadow: 0 12px 30px #1d2b3633; display: grid;
}
.menu nav a, .menu nav .linkish { display: block; padding: 0.75rem; color: var(--ink); text-decoration: none; border-radius: var(--radius-s); text-align: left; width: 100%; }
.menu nav a:hover, .menu nav .linkish:hover { background: var(--paper); }

/* Meldungen */
.flashes { margin-top: 1rem; }
.flash { margin: 0 0 0.5rem; padding: 0.7rem 0.9rem; border-radius: var(--radius-s); border-left: 4px solid var(--pine); background: #E3F0EC; }
.flash-error { border-color: var(--tomato); background: #FBE9E5; }
.flash-info { border-color: var(--ink-soft); background: #ECEFF1; }
.notice { padding: 0.8rem 1rem; background: #FFF4D2; border-radius: var(--radius-s); }

/* Formulare */
fieldset { border: 0; padding: 0; margin: 1.5rem 0; }
legend { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.5rem; }
.field { display: block; margin-bottom: 0.9rem; }
.field > span { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 0.25rem; }
.field abbr { color: var(--tomato); text-decoration: none; }
input, select, textarea {
  width: 100%; font: inherit; color: inherit; background: var(--surface);
  border: 1.5px solid var(--line); border-radius: var(--radius-s);
  padding: 0.7rem 0.75rem; min-height: 48px;
}
input:focus, select:focus, textarea:focus { border-color: var(--pine); outline: none; box-shadow: 0 0 0 3px #1f6f5c33; }
textarea.mono { font: 0.9rem/1.5 var(--mono); }
.check { display: flex; gap: 0.7rem; align-items: flex-start; margin: 1rem 0; }
.check input { width: 1.4rem; height: 1.4rem; min-height: 0; margin-top: 0.15rem; flex: none; accent-color: var(--pine); }
.grid2, .grid-zip { display: grid; gap: 0 0.75rem; }
@media (min-width: 34rem) {
  .grid2 { grid-template-columns: 1fr 1fr; }
  .grid-zip { grid-template-columns: 7rem 1fr; }
}
.hp { position: absolute; left: -9999px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px;
  padding: 0.6rem 1.1rem; border-radius: var(--radius-s); border: 1.5px solid var(--ink);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 650; text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--crayon); border-color: var(--crayon-deep); }
.btn-primary:hover { background: var(--crayon-deep); }
.btn-danger { background: var(--tomato); border-color: var(--tomato); color: #fff; }
.linkish { background: none; border: 0; padding: 0.3rem 0; font: inherit; color: var(--pine); text-decoration: underline; cursor: pointer; }
.danger { color: var(--tomato); }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1.2rem 0; }
form.inline { display: inline; margin-left: 0.5rem; }

/* Panels & Listen */
.panel { background: var(--surface); border-radius: var(--radius-l); padding: 1.1rem; margin: 1.2rem 0; border: 1px solid var(--line); }
.panel > h2:first-child { margin-top: 0; }
.narrow { max-width: 26rem; }
.card { font-style: normal; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 0.9rem; margin-bottom: 0.4rem; }
.danger-zone { border-color: #E9B8AD; }
.list, .plain { list-style: none; padding: 0; margin: 1rem 0; }
.list > li { border-bottom: 1px solid var(--line); }
.list a { display: grid; grid-template-columns: 1fr auto; gap: 0.1rem 1rem; padding: 0.9rem 0; color: inherit; text-decoration: none; }
.list-main { font-weight: 650; }
.list-meta { display: block; color: var(--ink-soft); font-size: 0.9rem; }
.list-side { grid-row: 1 / span 2; grid-column: 2; text-align: right; display: grid; gap: 0.2rem; justify-items: end; }
.list-row, .user { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; padding: 0.8rem 0; }
.list-row .list-main { flex: 1; }
.user > div:first-child { flex: 1 1 14rem; }
.user-actions { display: flex; flex-wrap: wrap; gap: 0 1rem; width: 100%; }
.plain li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.45rem 0; border-bottom: 1px dashed var(--line); }
.status { font-size: 0.8rem; padding: 0.15rem 0.55rem; border-radius: 99px; background: #E6EBEA; white-space: nowrap; }
.status-refunded, .status-active { background: #D4EDE4; color: #145443; }
.status-partially_refunded, .status-acknowledged, .status-pending { background: #FFF1C4; color: #6B4E00; }
.status-rejected, .status-blocked { background: #FADCD5; color: #86270F; }
.subnav, .chips { display: flex; gap: 0.4rem; overflow-x: auto; padding-bottom: 0.4rem; margin-bottom: 1rem; scrollbar-width: none; }
.subnav a, .chips a { flex: none; padding: 0.45rem 0.8rem; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-size: 0.92rem; }
.chips a[aria-current] { background: var(--ink); color: #fff; }

/* Tabelle */
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; margin: 1rem 0; }
.table th, .table td { text-align: left; padding: 0.55rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table .num { text-align: right; white-space: nowrap; }
.table tfoot td { font-weight: 700; border-bottom: 0; }

/* Zeilen im Forderungsformular */
.row { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 0.9rem 0.9rem 0.3rem; margin-bottom: 0.8rem; display: grid; gap: 0 0.7rem; grid-template-columns: 1fr 1fr; }
.row .field { margin-bottom: 0.7rem; }
.row .field:first-child, .row .wide, .row-tools { grid-column: 1 / -1; }
.row-tools { display: flex; justify-content: space-between; padding-bottom: 0.4rem; }
.row:only-child .js-remove { visibility: hidden; }

/* Der Kassenbon */
.receipt {
  position: sticky; bottom: 0; z-index: 10; margin: 1.5rem -1rem 0;
  padding: 1rem 1rem calc(0.9rem + env(safe-area-inset-bottom));
  background: var(--surface); color: var(--ink);
  box-shadow: 0 -8px 24px #1d2b361f;
}
.receipt::before {
  content: ""; position: absolute; left: 0; right: 0; top: -9px; height: 10px;
  background: linear-gradient(-45deg, var(--surface) 5px, transparent 0) 0 0 / 14px 10px repeat-x,
              linear-gradient(45deg, var(--surface) 5px, transparent 0) 0 0 / 14px 10px repeat-x;
}
.receipt-sum { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--mono); border-bottom: 1.5px dashed var(--ink-soft); padding-bottom: 0.5rem; margin-bottom: 0.7rem; }
.receipt-sum strong { font-size: 1.6rem; letter-spacing: -0.02em; }
.receipt-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 0.6rem; }
.receipt.bump strong { animation: bump 0.25s ease-out; }
@keyframes bump { 50% { transform: scale(1.07); } }

.preview pre { white-space: pre-wrap; font: 0.95rem/1.55 var(--font); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 1rem; }

/* Startseite, Inhaltsseiten, Statistik */
.hero h1 { font-size: 2.2rem; }
.hero-img, .prose img, .thumb { max-width: 100%; height: auto; border-radius: var(--radius-l); }
.thumb { max-width: 12rem; }
.prose { max-width: 38rem; }
.figures { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; margin: 1rem 0; }
.figures div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 0.8rem; }
.figures dt { font-size: 0.85rem; color: var(--ink-soft); }
.figures dd { margin: 0; font-size: 1.35rem; font-weight: 750; letter-spacing: -0.02em; }
.bars { list-style: none; padding: 0; }
.bars li { display: grid; grid-template-columns: 4.5rem 1fr; gap: 0.2rem 0.6rem; align-items: center; margin-bottom: 0.6rem; }
.bar { height: 0.9rem; width: var(--w); min-width: 3px; background: var(--pine); border-radius: 0 4px 4px 0; }
.bar-val { grid-column: 2; font-size: 0.85rem; color: var(--ink-soft); }
.defs dt { margin-top: 0.6rem; }
.defs dd { margin: 0; color: var(--ink-soft); }
.done { padding-top: 1rem; }

.footer { display: flex; gap: 1.2rem; justify-content: center; padding: 2rem 1rem calc(2rem + env(safe-area-inset-bottom)); font-size: 0.9rem; }
.footer a { color: var(--ink-soft); }

@media (min-width: 44rem) {
  .row { grid-template-columns: 1.3fr 1fr 1.3fr 0.8fr; }
  .figures { grid-template-columns: repeat(3, 1fr); }
  .receipt { margin: 1.5rem 0 0; border-radius: var(--radius-l) var(--radius-l) 0 0; }
}
@media (prefers-reduced-motion: reduce) { .receipt.bump strong { animation: none; } }
