/* puffbeans beancounter. Eine Datei für alle Seiten. */

@font-face {
  font-family: 'Ubuntu';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/ubuntu-latin-400-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Ubuntu';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/ubuntu-latin-500-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Ubuntu';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/ubuntu-latin-700-normal.woff2') format('woff2');
}

/* Farben aus dem Logo: das Grün der Bohne, das Schwarz der Kontur. */
:root {
  --green: #63a150;
  --green-ink: #2f6b1f;
  --green-soft: #edf5e9;
  --ink: #161815;
  --muted: #5d6459;
  --line: #e1e5db;
  --surface: #ffffff;
  --canvas: #f5f6f1;
  --danger: #a3261d;
  --danger-soft: #fdeceb;
  --warn: #8a4b00;
  --warn-soft: #fff3de;
  --info: #2b5a78;
  --info-soft: #e9f2f8;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(22 24 21 / 5%), 0 10px 28px -18px rgb(22 24 21 / 22%);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-family: 'Ubuntu', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  margin: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.7rem, 1.2rem + 1.6vw, 2.3rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.2rem;
  line-height: 1.3;
}

h3 {
  font-size: 1rem;
}

a {
  color: var(--green-ink);
  text-underline-offset: 2px;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 2px;
  border-radius: 6px;
}

[hidden] {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.875rem;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.mono {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ------------------------------------------------------------------ Rahmen */

.skip {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 10;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
}

.skip:focus {
  top: 12px;
}

.bar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.bar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 32px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 20px;
}

.brand {
  display: block;
  line-height: 0;
}

.brand img {
  width: auto;
  height: 76px;
}

.bar nav {
  display: flex;
  gap: 4px;
}

.bar nav a,
.bar nav button {
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.bar nav a:hover,
.bar nav button:hover {
  background: var(--canvas);
}

.bar nav .active {
  background: var(--green-soft);
  color: var(--green-ink);
  font-weight: 700;
}

main {
  flex: 1;
  display: grid;
  /* Die Spalte darf schmaler werden als ihr Inhalt, breite Tabellen rollen dann in ihrer Karte. */
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 24px;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 20px 56px;
}

.foot {
  padding: 18px 20px 28px;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted);
}

/* ------------------------------------------------------------------ Bausteine */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
}

.card > header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 16px;
  margin-bottom: 14px;
}

.stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

/* Schaltflächen: schwarze Kontur und versetzter Schatten wie beim Maskottchen */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
  transition:
    transform 80ms ease,
    box-shadow 80ms ease,
    background-color 120ms ease;
}

.button:hover:not(:disabled) {
  background: var(--green-soft);
}

.button:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 var(--ink);
}

.button.primary {
  background: var(--green);
}

.button.primary:hover:not(:disabled) {
  background: #71b05d;
}

.button:disabled {
  cursor: progress;
  border-color: #9aa095;
  color: #7c8277;
  background: #eef0ea;
  box-shadow: none;
}

.button.small {
  padding: 5px 12px;
  font-size: 0.875rem;
  box-shadow: 1px 1px 0 var(--ink);
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--green-ink);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--canvas);
  border: 1px solid var(--line);
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
}

.chip.good {
  background: var(--green-soft);
  border-color: #c9e0bf;
  color: var(--green-ink);
}

.chip.bad {
  background: var(--danger-soft);
  border-color: #f3c6c2;
  color: var(--danger);
}

.chip.warn {
  background: var(--warn-soft);
  border-color: #f1d9a8;
  color: var(--warn);
}

.notice {
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--canvas);
}

.notice.error {
  background: var(--danger-soft);
  border-color: #f3c6c2;
}

.notice.warning {
  background: var(--warn-soft);
  border-color: #f1d9a8;
}

.notice.info {
  background: var(--info-soft);
  border-color: #c7dcea;
}

.notice.good {
  background: var(--green-soft);
  border-color: #c9e0bf;
}

/* Tabellen */

.table-scroll {
  /* Bezugsrahmen für unsichtbare Beschriftungen in der Tabelle: Sonst ragen sie bei einer breiten
     Tabelle über den Rand und machen auf dem Handy die ganze Seite breiter. */
  position: relative;
  overflow-x: auto;
  margin-inline: -4px;
  padding-inline: 4px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

th {
  padding: 8px 10px;
  text-align: left;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th.num {
  text-align: right;
}

tbody tr:last-child td,
tfoot tr:last-child td {
  border-bottom: 0;
}

tfoot td {
  font-weight: 700;
  border-top: 2px solid var(--ink);
}

/* Formularfelder */

input[type='text'],
input[type='search'],
select {
  width: 100%;
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid #b9c0b2;
  border-radius: 8px;
  background: var(--surface);
}

input[type='text']:hover,
input[type='search']:hover,
select:hover {
  border-color: var(--ink);
}

/* Aufklappbare Bereiche: eigenes Dreieck statt der Markierung des Browsers */

summary {
  cursor: pointer;
  list-style: none;
}

summary::-webkit-details-marker {
  display: none;
}

summary::before {
  content: '';
  display: inline-block;
  flex: none;
  margin-right: 10px;
  border-left: 6px solid currentcolor;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  transition: transform 120ms ease;
}

details[open] > summary::before {
  transform: rotate(90deg);
}

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

.intro {
  display: grid;
  gap: 12px;
  padding-block: 12px 4px;
}

.lead {
  max-width: 68ch;
  font-size: 1.0625rem;
  color: var(--muted);
}

.upload {
  display: grid;
  justify-items: center;
  gap: 16px;
}

.drop {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  width: 100%;
  padding: 30px 18px;
  border: 2px dashed #aab2a3;
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
  cursor: pointer;
  transition:
    border-color 120ms ease,
    background-color 120ms ease;
}

.drop:hover,
.drop.over {
  border-color: var(--ink);
  background: var(--green-soft);
}

.drop:focus-within {
  outline: 3px solid var(--green);
  outline-offset: 2px;
}

.drop svg {
  color: var(--green-ink);
}

.drop .title {
  font-size: 1.125rem;
  font-weight: 700;
}

.drop .hint {
  max-width: 52ch;
  color: var(--muted);
}

.drop input[type='file'] {
  max-width: 100%;
  margin-top: 8px;
}

.drop .chosen {
  margin-top: 6px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

/* Mit Skript übernimmt die Fläche selbst die Auswahl, das Feld des Browsers wird unsichtbar. */
.js .drop input[type='file'] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.js .drop::after {
  content: attr(data-pick);
  margin-top: 6px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--green-ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.upload.busy .drop::after {
  content: 'Die Berichte werden ausgewertet …';
  color: var(--muted);
  text-decoration: none;
}

.js .upload > .button {
  display: none;
}

.needs {
  display: grid;
  gap: 10px;
}

/* Die Bitte um den Umsatzsteuer-Bericht: deutlich, aber kein Fehler */
.request {
  display: grid;
  gap: 12px;
  border-color: #f1d9a8;
  background: var(--warn-soft);
}

.request p {
  max-width: 82ch;
}

.request .drop {
  padding-block: 20px;
}

.needs h2 {
  font-size: 1rem;
}

.needs ol {
  display: grid;
  gap: 6px;
  max-width: 82ch;
  margin: 0;
  padding-left: 22px;
}

.needs p {
  max-width: 82ch;
}

/* Die Berichte, die die App braucht: je Bericht wozu und wo */
.reports {
  gap: 18px;
}

.reports > li::marker {
  font-weight: 700;
}

.reports h3 {
  margin-bottom: 4px;
  font-size: 1rem;
}

.reports p + p {
  margin-top: 6px;
}

.where {
  display: grid;
  gap: 6px;
  max-width: 82ch;
  margin: 6px 0 0;
  padding-left: 20px;
}

.request ul {
  margin-block: 0;
}

.file-list {
  display: grid;
  gap: 6px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.file-list:last-child {
  margin-bottom: 0;
}

.file-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.9375rem;
}

.file-name {
  min-width: 0;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.file-list .link-button {
  margin-left: auto;
}

.add {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  font-size: 0.9375rem;
}

.add label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  min-width: 0;
}

.add label span {
  font-weight: 500;
}

.add input[type='file'] {
  max-width: 100%;
}

.summary {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px 40px;
  border: 2px solid var(--ink);
  box-shadow: 5px 5px 0 var(--green);
}

.eyebrow {
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.payout {
  text-align: right;
}

.amount {
  font-size: clamp(2rem, 1.4rem + 2.4vw, 2.9rem);
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 8px;
}

/* Meldungen */

.issues {
  display: grid;
  gap: 12px;
}

.issues h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.issues p {
  max-width: 78ch;
}

.badge {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #fff;
  background: var(--muted);
}

.error .badge {
  background: var(--danger);
}

.warning .badge {
  background: var(--warn);
}

.info .badge {
  background: var(--info);
}

.ids {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.ids li {
  padding: 2px 9px;
  border-radius: 6px;
  background: rgb(255 255 255 / 70%);
  border: 1px solid rgb(22 24 21 / 12%);
  font-size: 0.875rem;
}

.issues .details {
  margin: 8px 0 0;
  padding-left: 20px;
  font-size: 0.9375rem;
}

.issues .more {
  margin-top: 8px;
  font-size: 0.875rem;
}

.issues .more summary {
  color: var(--green-ink);
  font-weight: 500;
}

.issues .actions {
  margin-top: 8px;
  font-size: 0.875rem;
}

/* Abgleich mit der Auszahlung */

.part {
  border-bottom: 1px solid var(--line);
}

.part > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding: 9px 10px;
  font-weight: 500;
}

.part > summary::before {
  align-self: center;
  margin-right: 0;
}

.part > summary .num {
  margin-left: auto;
  font-weight: 400;
}

.part.problem > summary {
  color: var(--danger);
  font-weight: 700;
}

.part.problem > summary .num {
  font-weight: 700;
}

.part > .table-scroll {
  margin: 0 0 10px;
  padding: 0 0 0 28px;
  background: var(--canvas);
}

.breakdown {
  font-size: 0.875rem;
}

.totals td {
  padding: 9px 10px;
}

.totals .sum td {
  font-weight: 700;
  border-top: 2px solid var(--ink);
  border-bottom: 0;
}

.totals .reported td {
  color: var(--muted);
}

.recon .notice {
  margin-top: 14px;
}

/* Belege */

.vouchers-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px 24px;
}

.vouchers-head p {
  max-width: 78ch;
}

.overview td.action {
  text-align: right;
}

.overview td.mono {
  white-space: nowrap;
}

.overview tfoot td {
  font-weight: 400;
  border-top: 1px solid var(--line);
}

.voucher {
  border-top: 5px solid var(--green);
  scroll-margin-top: 16px;
}

.voucher.einnahmenminderung,
.voucher.ausgabenminderung {
  border-top-color: #b9d4ae;
}

.voucher.ausgabe {
  border-top-color: var(--ink);
}

.voucher > header {
  align-items: center;
}

.voucher h3 {
  font-size: 1.15rem;
}

.voucher .total {
  font-size: 1.5rem;
  font-weight: 700;
}

.positions th.num {
  width: 118px;
}

.positions th.num:first-of-type {
  width: 96px;
}

.positions tr.item td {
  font-weight: 500;
}

.positions tr.line td {
  padding-block: 5px;
  font-size: 0.875rem;
  color: var(--muted);
  border-bottom-style: dashed;
}

.positions tr.line td:first-child {
  padding-left: 26px;
}

.orders {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.orders > summary {
  padding: 9px 14px;
  font-size: 0.9375rem;
  font-weight: 500;
}

.orders table {
  font-size: 0.875rem;
}

.orders .table-scroll {
  margin: 0;
  padding: 0 4px 6px;
}

.voucher .note {
  max-width: 86ch;
  margin-top: 12px;
}

.voucher .note + .note {
  margin-top: 2px;
}

.voucher > footer {
  margin-top: 16px;
}

.transit-note {
  margin-top: 14px;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px 24px;
  margin: 0;
}

.facts dt {
  font-size: 0.875rem;
  color: var(--muted);
}

.facts dd {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.facts dd.bad {
  color: var(--warn);
}

.facts + .table-scroll {
  margin-top: 16px;
}

/* Alle Zeilen */

.rows > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
}

.rows > summary::before {
  align-self: center;
  margin-right: 0;
  border-left-width: 7px;
  border-top-width: 6px;
  border-bottom-width: 6px;
}

.rows table {
  margin-top: 12px;
  font-size: 0.875rem;
}

.rows tr.problem td {
  background: var(--danger-soft);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
}

.filters .chip {
  cursor: pointer;
}

.filters .chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

/* ------------------------------------------------------------------ Zuordnung */

.mapping {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
}

.page-head {
  display: grid;
  gap: 10px;
}

.page-head .lead {
  max-width: 72ch;
}

.storage {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  max-width: 86ch;
}

.explain {
  max-width: 82ch;
  margin-bottom: 14px;
}

.field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin-bottom: 12px;
}

.field label {
  font-weight: 500;
}

.field .check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.field select {
  width: min(100%, 20rem);
}

.mapping code {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--canvas);
  border: 1px solid var(--line);
  font-size: 0.9em;
}

.tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.search input {
  min-width: 220px;
}

.mapping td {
  vertical-align: middle;
  padding: 6px;
}

.mapping th {
  padding-inline: 6px;
}

.mapping td input,
.mapping td select {
  min-width: 120px;
}

.mapping td.rate input {
  min-width: 80px;
  max-width: 100px;
}

.rules td:nth-child(4) select {
  min-width: 310px;
}

.rules td:nth-child(5) select {
  min-width: 150px;
}

.rules select.unused {
  visibility: hidden;
}

.mapping td.action {
  text-align: right;
  white-space: nowrap;
}

.mapping tr.new td {
  background: var(--green-soft);
}

.mapping tr.new td:first-child {
  box-shadow: inset 4px 0 0 var(--green);
}

.defaults {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  margin-top: 16px;
}

.save-bar {
  position: sticky;
  bottom: 16px;
  z-index: 4;
  justify-self: end;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 10px 12px 10px 20px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 4px 4px 0 var(--green);
  font-weight: 500;
}

/* ------------------------------------------------------------------ Schmale Bildschirme */

@media (max-width: 640px) {
  .bar-inner {
    padding-inline: 16px;
  }

  .brand img {
    height: 60px;
  }

  main {
    padding: 22px 16px 40px;
  }

  .card {
    padding: 18px 16px;
  }

  .payout {
    text-align: left;
  }

  .chips {
    justify-content: flex-start;
  }

  .save-bar {
    justify-self: stretch;
    justify-content: flex-end;
    border-radius: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
