/* Buchhaltung Pilot, Oberflaeche V4.1.
   Uebernommen aus der abgenommenen V4.1 Quelle, lesbar formatiert und
   auf Gleichwertigkeit geprueft. Keine externen Schriften, Bilder oder
   Stilimporte, damit die Seite ohne externe Anfragen funktioniert. */

:root {
  --bg: #f4f2ec;
  --card: #fffefa;
  --ink: #1f211e;
  --muted: #6d716b;
  --line: #d9dbd4;
  --green: #4f7a5e;
  --green2: #e0efe4;
  --green3: #cde4d3;
  --amber: #936321;
  --amber2: #f7ead4;
  --red: #91483c;
  --red2: #f5e2df;
  --shadow: 0 10px 28px rgba(37, 40, 35, .08);
  --r: 20px
}

* {
  box-sizing: border-box
}
html {
  background: #e7e6e1
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Aptos", "Segoe UI", sans-serif
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit
}
button {
  cursor: pointer
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid #275e3b;
  outline-offset: 2px
}
.hidden {
  display: none!important
}
.app {
  width: min(100%, 560px);
  min-height: 100vh;
  margin: auto;
  padding: 0 18px 104px;
  background: var(--bg)
}

header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: end;
  gap: 15px;
  padding: 27px 4px 17px;
  border-bottom: 1px solid var(--line)
}
.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: .9rem
}
h1,
h2,
h3 {
  font-family: Georgia, serif
}
h1 {
  margin: 0;
  font-size: 2rem
}
.avatar {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  font-weight: 800
}
.hero {
  padding: 22px 4px 14px
}
.hero h2 {
  margin: 0 0 5px;
  font-size: 1.55rem
}
.hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45
}

.progress {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 0 0 14px;
  padding: 14px 15px;
  border: 1px solid #b9d3c0;
  border-radius: 17px;
  background: var(--green2)
}
.progress-ring {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--green);
  color: #fff;
  font-weight: 800
}
.progress strong {
  display: block
}
.progress span {
  color: #4e6153;
  font-size: .9rem
}
.bar {
  height: 7px;
  margin-top: 7px;
  border-radius: 99px;
  background: #c9d9cd;
  overflow: hidden
}
.bar i {
  display: block;
  height: 100%;
  background: var(--green);
  transition: width .3s ease
}

.view-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin: 15px 0 18px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #e9e7e0
}
.view-switch button {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 800
}
.view-switch button.active {
  background: var(--card);
  color: var(--green);
  box-shadow: 0 2px 8px rgba(37, 40, 35, .08)
}
.toolbar {
  display: flex;
  gap: 8px;
  margin: 0 0 13px
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  background: var(--card);
  text-align: center;
  text-decoration: none;
  color: var(--ink);
  font-weight: 750;
  line-height: 1.2
}
.btn.primary {
  border-color: var(--green);
  background: var(--green);
  color: #fff
}
.btn.soft {
  border-color: #b9d3c0;
  background: var(--green2);
  color: #31533c
}
.btn.danger {
  border-color: #d7aaa3;
  color: var(--red)
}
.btn.small {
  min-height: 38px;
  padding: 0 11px;
  font-size: .9rem
}
.btn:disabled {
  opacity: .52;
  cursor: not-allowed
}
.stack {
  display: grid;
  gap: 11px
}

.task {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 13px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
  box-shadow: var(--shadow);
  transition: background .25s, transform .25s
}
.task.done {
  border-color: #a9cbb2;
  background: var(--green2);
  box-shadow: none;
  animation: complete .45s ease
}
.task.done .task-icon {
  background: var(--green);
  color: #fff
}
.task.done h3 {
  text-decoration: line-through;
  text-decoration-thickness: 1px
}
.task.overdue:not(.done) {
  border-color: #dfb0aa
}
.task.urgent:not(.done) .task-icon {
  background: var(--red2);
  color: var(--red)
}

@keyframes complete {
  50% {
    transform: scale(1.015)
  }

}
.task-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--amber2);
  color: var(--amber);
  font-weight: 900;
  font-size: 1.2rem
}
.task-main {
  min-width: 0
}
.task-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px
}
.task h3 {
  margin: 1px 0 5px;
  font: 700 1.06rem/1.25 Georgia, serif
}
.status {
  flex: none;
  border-radius: 99px;
  padding: 4px 8px;
  background: #eeeae1;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 800
}
.task.done .status {
  background: var(--green3);
  color: #31533c
}
.task p {
  margin: 0;
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.4
}
.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px
}
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 3px 8px;
  border-radius: 99px;
  background: #efede7;
  color: #555b54;
  font-size: .78rem;
  font-weight: 700
}
.chip.red {
  background: var(--red2);
  color: var(--red)
}
.chip.blue {
  background: var(--green2);
  color: #31533c
}
.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 26px 4px 10px
}
.section-head h2 {
  margin: 0;
  font-size: 1.3rem
}
.section-head span {
  color: var(--muted);
  font-size: .86rem
}
.money-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px
}
.money {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--card)
}
.money span {
  color: var(--muted);
  font-size: .84rem
}
.money strong {
  display: block;
  margin-top: 5px;
  font: 700 1.35rem Georgia, serif
}

.bottom-nav {
  position: fixed;
  z-index: 5;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 560px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 254, 250, .96);
  backdrop-filter: blur(12px)
}
.bottom-nav button {
  min-height: 60px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: .78rem
}
.bottom-nav button:first-child {
  background: var(--green2);
  color: var(--green);
  font-weight: 800
}
.bottom-nav b {
  display: block;
  font-size: 1.25rem
}

.modal-bg {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  align-items: end;
  background: rgba(25, 28, 24, .48)
}
.modal {
  width: min(100%, 680px);
  max-height: calc(100vh - 20px);
  max-height: calc(100svh - 20px);
  margin: auto;
  overflow: auto;
  border-radius: 28px 28px 0 0;
  background: var(--bg);
  box-shadow: 0 -20px 55px rgba(0, 0, 0, .2)
}
.modal-head {
  position: sticky;
  z-index: 3;
  top: 0;
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: start;
  padding: 17px 18px 13px;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 242, 236, .97);
  backdrop-filter: blur(10px)
}
.modal-head h2 {
  margin: 0 0 3px;
  font-size: 1.45rem
}
.modal-head p {
  margin: 0;
  color: var(--muted);
  font-size: .9rem
}
.close {
  width: 44px;
  height: 44px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  font-size: 1.2rem
}
.modal-body {
  padding: 18px 18px calc(26px + env(safe-area-inset-bottom))
}
.choice-grid {
  display: grid;
  gap: 11px
}
.choice {
  width: 100%;
  min-height: 100px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  text-align: left;
  box-shadow: var(--shadow)
}
.choice strong {
  display: block;
  margin-bottom: 6px;
  font: 700 1.15rem Georgia, serif
}
.choice span {
  color: var(--muted);
  line-height: 1.4
}
.tag {
  display: inline-block!important;
  margin-top: 10px;
  padding: 5px 8px;
  border-radius: 99px;
  background: var(--green2);
  color: var(--green)!important;
  font-size: .8rem;
  font-weight: 800
}

.steps {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  margin-bottom: 16px
}
.steps button {
  min-height: 43px;
  padding: 4px;
  border: 0;
  border-radius: 10px;
  background: #e8e6df;
  color: var(--muted);
  font-size: .73rem
}
.steps button.active {
  background: var(--green);
  color: #fff;
  font-weight: 800
}
.panel-title {
  margin: 17px 0 10px
}
.panel-title h3 {
  margin: 0 0 4px;
  font-size: 1.2rem
}
.panel-title p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
  font-size: .9rem
}
.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  font-weight: 750;
  min-width: 0
}
.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid #c7cac3;
  border-radius: 12px;
  background: var(--card)
}
.field textarea {
  min-height: 110px;
  resize: vertical
}
.cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px
}
.data-list {
  display: grid;
  gap: 8px
}
.data-row {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--card)
}
.row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px
}
.row-top strong {
  line-height: 1.3
}
.counter {
  display: flex;
  align-items: center;
  gap: 7px
}
.counter button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  font-weight: 900
}
.counter output {
  min-width: 25px;
  text-align: center;
  font-weight: 800
}
.note {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: .83rem
}
.box {
  margin-top: 12px;
  padding: 13px;
  border: 1px dashed #afb3aa;
  border-radius: 16px;
  background: #efede7
}
.box h4 {
  margin: 0 0 10px
}
.student {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 44px;
  gap: 7px;
  align-items: center
}
.student input,
.student select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card)
}
.student-card {
  padding: 10px 11px
}
.student-options {
  margin-top: 7px;
  padding: 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent
}
.student-options summary {
  min-height: 40px;
  padding: 10px 2px 7px;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 750;
  cursor: pointer
}
.student-options[open] summary {
  margin-bottom: 8px
}
.student-options .field:last-child {
  margin-bottom: 0
}
.icon-btn {
  width: 44px;
  height: 44px;
  border: 1px solid #d6aaa4;
  border-radius: 10px;
  background: var(--card);
  color: var(--red)
}

.change-types {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px
}
.change-types button {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--card);
  font-weight: 750
}
.change-types button.active {
  border-color: var(--green);
  background: var(--green2);
  color: #31533c
}
.change-item {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--card);
  line-height: 1.4
}
.change-item small {
  display: block;
  margin-top: 3px;
  color: var(--muted)
}
.notice {
  margin: 12px 0;
  padding: 14px;
  border-radius: 15px;
  background: var(--amber2);
  color: #5d431d;
  line-height: 1.45
}
.notice.green {
  background: var(--green2);
  color: #31533c
}
.notice.red {
  background: var(--red2);
  color: #71372f
}
.notice strong {
  display: block;
  margin-bottom: 4px
}
.review-grid {
  display: grid;
  gap: 13px
}
.preview-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--card)
}
.preview-card h3 {
  margin: 0 0 10px;
  font-size: 1.15rem
}
.paper-wrap {
  padding: 10px;
  border-radius: 12px;
  background: #deddd8;
  overflow: auto
}
.paper {
  width: 100%;
  min-height: 430px;
  padding: 25px 22px;
  background: #fff;
  box-shadow: 0 5px 15px rgba(0, 0, 0, .13);
  font-family: Arial, sans-serif;
  font-size: .76rem;
  color: #222
}
.paper-head {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding-bottom: 18px;
  border-bottom: 2px solid #222
}
.paper h4 {
  margin: 25px 0 12px;
  font-size: 1.05rem
}
.invoice-table {
  width: 100%;
  border-collapse: collapse
}
.invoice-table th,
.invoice-table td {
  padding: 7px 4px;
  border-bottom: 1px solid #ddd;
  text-align: left
}
.invoice-table th:last-child,
.invoice-table td:last-child {
  text-align: right
}
.paper-total {
  text-align: right;
  margin-top: 15px;
  font-size: .95rem
}
.provisional {
  margin: 0 0 7px;
  color: var(--amber);
  font-weight: 800
}
.footer-actions {
  position: sticky;
  bottom: 0;
  bottom: max(8px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 18px -18px -26px;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(244, 242, 236, .98)
}

.send-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  margin-bottom: 11px
}
.send-card h3 {
  margin: 0 0 9px;
  font-size: 1.12rem
}
.attachment {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border-radius: 12px;
  background: #efede7
}
.attachment b {
  font-size: 1.35rem
}
.contact-search {
  margin: 14px 0 10px
}
.contact-search input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none
}
.contact-row {
  display: grid;
  grid-template-columns: 1fr 1fr 44px;
  gap: 7px;
  margin-top: 8px
}
.contact-row input {
  min-width: 0;
  min-height: 44px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card)
}
details {
  margin-top: 12px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f2f0ea
}
summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  font-weight: 800;
  cursor: pointer
}
.tax-status {
  padding: 16px;
  border: 2px solid #d0a05f;
  border-radius: 18px;
  background: var(--amber2)
}
.tax-status h3 {
  margin: 0 0 7px
}
.checklist {
  display: grid;
  gap: 8px;
  margin-top: 12px
}
.check {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 9px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .55)
}
.check b {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: var(--amber)
}
.invoice-overview-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 14px
}
.invoice-overview-meta .field {
  margin-bottom: 0
}
.invoice-overview-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px
}
.invoice-overview-actions .btn {
  width: 100%;
  min-height: 52px
}
.invoice-overview-head h3 {
  margin: 0
}
/* Mobile Rechnungs-Hauptseite: Inhalte umbrechen statt seitlich abschneiden. */
@media(max-width: 520px) {
  #invoices-page .year-summary {
    grid-template-columns: minmax(0, 1fr)
  }
  #invoices-page .invoice-row {
    min-width: 0;
    overflow-wrap: anywhere
  }
}
.invoice-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 12px 0
}
.invoice-filters button.active {
  border-color: var(--green);
  background: var(--green2);
  color: #31533c
}
.invoice-list {
  display: grid;
  gap: 8px
}
.invoice-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card)
}
.invoice-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: .85rem
}
.invoice-row .task-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 8px
}
.invoice-row .task-actions .btn {
  width: 100%;
  min-height: 44px;
  padding: 6px 10px
}
.invoice-row .amount {
  text-align: right;
  font-weight: 850
}
.invoice-row .amount.out {
  color: var(--green)
}
.invoice-row .amount.in {
  color: var(--red)
}
.year-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0
}
.year-summary div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card)
}
.year-summary span {
  display: block;
  color: var(--muted);
  font-size: .78rem
}
.year-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 1.05rem
}
.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px
}
.toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 88px;
  transform: translate(-50%, 15px);
  width: min(calc(100% - 36px), 520px);
  padding: 14px 15px;
  border-radius: 13px;
  background: #273229;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: .2s
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0)
}

/* V2 Dokumente, Belege und Finanzen */
.receipt-tools {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: end
}
.receipt-list,
.booking-list {
  display: grid;
  gap: 8px
}
.gmail-inbox { margin-bottom:22px; padding-bottom:18px; border-bottom:1px solid var(--line) }
.gmail-candidate-list { display:grid; gap:8px; margin:12px 0 }
.gmail-candidate { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:12px; align-items:center; padding:14px; border:1px solid var(--line); border-radius:15px; background:var(--card) }
.gmail-candidate p,.gmail-candidate small { display:block; margin:4px 0 0; color:var(--muted) }
@media (max-width:480px) { .gmail-candidate { grid-template-columns:1fr } .gmail-candidate .btn { width:100%; min-height:44px } }
.receipt-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--card)
}
.receipt-row p,
.receipt-row small {
  display: block;
  margin: 4px 0 0;
  color: var(--muted)
}
.receipt-row .amount {
  font-weight: 850
}
.empty-state {
  padding: 28px 18px;
  border: 1px dashed #aeb2aa;
  border-radius: 16px;
  background: #efede7;
  text-align: center
}
.empty-state p {
  margin: 6px 0 0;
  color: var(--muted)
}
.file-choice {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border: 1px solid var(--green);
  border-radius: 13px;
  background: var(--green2);
  color: #31533c;
  font-weight: 800;
  cursor: pointer
}
.file-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0
}
.file-choice:focus-within {
  outline: 3px solid #275e3b;
  outline-offset: 2px
}
.period-select {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px
}
.finance-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px
}
.finance-summary>div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--card)
}
.finance-summary span,
.finance-summary small {
  display: block;
  color: var(--muted);
  font-size: .8rem
}
.finance-summary strong {
  display: block;
  margin: 5px 0;
  font: 700 1.15rem Georgia, serif
}
.booking-row {
  width: 100%;
  min-height: 64px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  text-align: left
}
.booking-row span {
  min-width: 0
}
.booking-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted)
}
.booking-row b {
  flex: none
}
.detail-list {
  display: grid;
  gap: 0;
  margin: 0
}
.detail-list div {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line)
}
.detail-list dt {
  color: var(--muted)
}
.detail-list dd {
  margin: 0;
  font-weight: 750
}
.paper-pages {
  display: grid;
  gap: 14px;
  width: 680px
}
.sheet-page,
.letter-page {
  position: relative;
  width: 680px;
  min-height: 880px;
  padding: 52px 42px 42px;
  background: #fff;
  box-shadow: 0 5px 15px rgba(0, 0, 0, .13);
  color: #1f211e;
  font: 12px/1.45 Arial, sans-serif
}
.excel-sheet {
  background-color: #fff;
  background-image: linear-gradient(#e8e8e8 1px, transparent 1px), linear-gradient(90deg, #e8e8e8 1px, transparent 1px);
  background-size: 24px 24px
}
.test-ribbon {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  min-height: 32px;
  padding: 8px 14px;
  background: #f7ead4;
  color: #5d431d;
  font-weight: 900;
  letter-spacing: .02em;
  text-align: center
}
.recipient-grid {
  width: 250px;
  margin: 0 0 48px auto;
  display: grid;
  grid-template-rows: repeat(4, 24px);
  padding: 0 8px;
  background: rgba(255, 255, 255, .9);
  border: 1px solid #aaa
}
.recipient-grid>* {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #d5d5d5
}
.recipient-grid>*:last-child {
  border: 0
}
.issuer-grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  margin-bottom: 28px;
  border: 1px solid #929292;
  background: rgba(255, 255, 255, .94)
}
.issuer-grid>* {
  min-height: 27px;
  padding: 5px 7px;
  border-right: 1px solid #b5b5b5;
  border-bottom: 1px solid #b5b5b5
}
.issuer-grid>*:nth-child(even) {
  border-right: 0
}
.sheet-page h4 {
  margin: 22px 0 10px;
  font: 700 17px Georgia, serif
}
.grid-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff
}
.grid-table th,
.grid-table td {
  height: 31px;
  padding: 5px 6px;
  border: 1px solid #8f8f8f;
  text-align: left
}
.grid-table th {
  background: #e6eee7;
  font-weight: 800
}
.grid-table th:nth-child(2),
.grid-table th:nth-child(3),
.grid-table th:nth-child(4),
.grid-table td:nth-child(2),
.grid-table td:nth-child(3),
.grid-table td:nth-child(4) {
  text-align: right
}
.student-grid th:nth-child(2),
.student-grid th:nth-child(3),
.student-grid td:nth-child(2),
.student-grid td:nth-child(3) {
  text-align: left
}
.grand-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 26px 0 18px;
  padding: 18px;
  border: 3px double #31533c;
  background: #e0efe4;
  font-size: 17px
}
.tax-warning {
  display: grid;
  gap: 4px;
  margin-bottom: 24px;
  padding: 12px;
  border: 2px solid #936321;
  background: #fff7e8;
  color: #5d431d
}
.sheet-filler {
  height: 250px
}
.sheet-filler.short {
  height: 90px
}
.page-number {
  position: absolute;
  right: 42px;
  bottom: 18px;
  color: #555
}
.letter-page {
  font: 15px/1.65 Georgia, serif
}
.letter-recipient {
  display: grid;
  margin-bottom: 78px;
  font-size: 18px;
  line-height: 1.4
}
.letter-sender h4 {
  margin: 0 0 13px;
  font-size: 17px
}
.letter-sender dl {
  display: grid;
  grid-template-columns: 165px 1fr;
  margin: 0;
  font-family: Arial, sans-serif;
  font-size: 13px
}
.letter-sender dt,
.letter-sender dd {
  min-height: 29px;
  margin: 0;
  padding: 5px 0
}
.letter-sender dt {
  font-weight: 800
}
.letter-page hr {
  margin: 30px 0 38px;
  border: 0;
  border-top: 2px solid #222
}
.letter-closing {
  margin-top: 44px
}
.bottom-nav button {
  min-height: 60px
}
.bottom-nav button:focus-visible {
  outline: 3px solid #275e3b;
  outline-offset: -3px
}

.invoice-filters .btn.small {
  min-height: 44px
}

@media(max-width: 520px) {
  .student-card {
    padding: 8px
  }
  .student-card .student {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px;
    gap: 4px
  }
  .student-card .icon-btn {
    width: 40px;
    height: 40px
  }
  .receipt-tools {
    grid-template-columns: 1fr
  }
  .period-select {
    grid-template-columns: 1fr 1fr
  }
  .finance-summary {
    grid-template-columns: 1fr
  }
  .detail-list div {
    grid-template-columns: 105px 1fr
  }
  .paper-wrap {
    padding: 8px
  }
  .paper-pages {
    width: 100%
  }
  .sheet-page,
  .letter-page {
    width: 100%;
    min-height: 760px;
    padding: 48px 18px 36px;
    font-size: 10px
  }
  .recipient-grid {
    width: min(250px, 85%)
  }
  .issuer-grid {
    grid-template-columns: 120px 1fr
  }
  .grid-table th,
  .grid-table td {
    padding: 3px;
    font-size: 8px
  }
  .page-number {
    right: 18px
  }
  .letter-page {
    font-size: 13px
  }
  .letter-recipient {
    font-size: 16px
  }
  .letter-sender dl {
    grid-template-columns: 105px minmax(0, 1fr);
    column-gap: 8px;
    font-size: 11px
  }
  .letter-sender dd {
    overflow-wrap: anywhere
  }

}

@media(min-width: 780px) {
  body {
    padding: 24px
  }
  .app {
    min-height: calc(100vh - 48px);
    border: 1px solid #d0d2cc;
    border-radius: 28px;
    box-shadow: 0 22px 58px rgba(35, 38, 33, .14)
  }
  .bottom-nav {
    bottom: 24px;
    border-radius: 0 0 28px 28px
  }
  .modal {
    align-self: center;
    max-height: calc(100vh - 48px);
    max-height: calc(100svh - 48px);
    border-radius: 26px
  }
  .review-grid {
    grid-template-columns: 1fr
  }
  .paper {
    min-height: 520px
  }

}

@media(max-width: 390px) {
  .cols {
    grid-template-columns: 1fr
  }
  .steps button {
    font-size: .65rem
  }
  .contact-row {
    grid-template-columns: 1fr 44px
  }
  .contact-row input:nth-child(2) {
    grid-column: 1
  }
  .change-types {
    grid-template-columns: 1fr
  }
  .money-grid {
    grid-template-columns: 1fr 1fr
  }

}

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

}

.task-window-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin: 0 0 14px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #e9e7e0
}
.task-window-switch button {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 800
}
.task-window-switch button.active {
  background: var(--card);
  color: var(--green)
}
.overview-focus {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid #b9d3c0;
  border-radius: 17px;
  background: var(--green2)
}
.overview-focus h3 {
  margin: 0 0 6px
}
.overview-focus p {
  margin: 0;
  color: #4e6153;
  line-height: 1.45
}
.assistant-stack,
.reserve-grid {
  display: grid;
  gap: 10px
}
.assistant-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--card)
}
.assistant-card h3 {
  margin: 0 0 7px
}
.assistant-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45
}
.source-state {
  display: inline-flex;
  margin-top: 10px;
  padding: 4px 8px;
  border-radius: 99px;
  background: var(--amber2);
  color: var(--amber);
  font-size: .78rem;
  font-weight: 800
}
.reserve-grid {
  grid-template-columns: repeat(3, 1fr);
  margin: 12px 0
}
.reserve-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card)
}
.reserve-card span {
  display: block;
  color: var(--muted);
  font-size: .82rem
}
.reserve-card strong {
  display: block;
  margin-top: 5px;
  font: 700 1.25rem Georgia, serif
}
.contact-search {
  width: 100%;
  min-height: 48px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 13px;
  background: var(--card)
}
.automatic-note {
  margin-top: 7px;
  color: var(--green);
  font-size: .8rem;
  font-weight: 700
}

@media(max-width: 430px) {
  .reserve-grid {
    grid-template-columns: 1fr
  }
  .overview-focus {
    padding: 14px
  }

}

/* V4 echte Hauptseiten und ruhige Arbeitsflächen */
.main-page {
  animation: page-in .22s ease
}
.page-head {
  padding: 24px 4px 18px
}
.page-head h2 {
  margin: 3px 0 6px;
  font-size: 1.65rem
}
.page-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45
}
.page-kicker {
  color: var(--green);
  font-size: .78rem;
  font-weight: 850;
  letter-spacing: .06em;
  text-transform: uppercase
}
.page-content {
  display: grid;
  gap: 14px
}
.bottom-nav button:first-child {
  background: transparent;
  color: var(--muted);
  font-weight: 400
}
.bottom-nav button.active {
  background: var(--green2);
  color: var(--green);
  font-weight: 850
}
.filters {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin: 0 0 16px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #e9e7e0
}
.filter {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 800
}
.filter.active {
  background: var(--card);
  color: var(--green);
  box-shadow: 0 2px 8px rgba(37, 40, 35, .08)
}
.year-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 4px
}
.section-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card)
}
.section-card h3 {
  margin: 0 0 5px
}
.section-card>p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45
}
.booking-list {
  gap: 10px;
  margin-top: 4px
}
.booking-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 78px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 5px 16px rgba(37, 40, 35, .045)
}
.booking-row>span {
  display: grid;
  gap: 5px
}
.booking-title {
  font: 700 1rem/1.3 Georgia, serif
}
.booking-meta {
  display: block;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.35
}
.booking-amount {
  align-self: center;
  font-size: .96rem;
  white-space: nowrap
}
.finance-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin: 16px 0
}
.guardian-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px;
  border: 1px solid #b9d3c0;
  border-radius: 17px;
  background: var(--green2)
}
.guardian-summary strong {
  display: block
}
.guardian-summary span {
  color: #4e6153;
  font-size: .86rem
}
.guardian-list {
  display: grid;
  gap: 10px;
  margin-top: 13px
}
.guardian-finding {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--card)
}
.guardian-finding h3 {
  margin: 0 0 6px;
  font-size: 1.08rem
}
.guardian-finding p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45
}
.guardian-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0
}
.guardian-empty {
  padding: 22px;
  border: 1px dashed #aeb2aa;
  border-radius: 17px;
  background: #efede7;
  text-align: center
}
.recipient-panel {
  margin: 14px 0;
  padding: 15px;
  border: 1px solid #b9d3c0;
  border-radius: 17px;
  background: var(--green2)
}
.recipient-panel h3 {
  margin: 0 0 5px
}
.recipient-panel>p {
  margin: 0 0 12px;
  color: #4e6153;
  font-size: .9rem
}
.recipient-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
  align-items: end
}

@keyframes page-in {
  from {
    opacity: .35;
    transform: translateY(4px)
  }
  to {
    opacity: 1;
    transform: none
  }

}

@media(max-width: 430px) {
  .finance-actions,
  .recipient-actions {
    grid-template-columns: 1fr
  }
  .booking-row {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 13px
  }
  .filters {
    gap: 3px
  }
  .filter {
    padding: 0 5px;
    font-size: .82rem
  }

}

/* Ergaenzung fuer die Django Integration: serverseitige Abmeldung im Kopf.
   Der Avatar bleibt als rein dekoratives Zeichen erhalten. */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px
}
.avatar {
  display: grid;
  place-items: center
}

/* Geschützte Anmeldung im gleichen ruhigen Erscheinungsbild. */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px
}
.login-shell {
  width: min(100%, 430px)
}
.login-card {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow)
}
.login-card h1 {
  margin: 3px 0 8px
}
.login-intro {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.45
}
.login-form {
  display: grid;
  gap: 4px
}
.login-form .field input {
  margin-top: 2px
}
.login-submit {
  width: 100%;
  margin-top: 4px
}
.login-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.4
}
@media(max-width: 430px) {
  .login-body {
    padding: 14px
  }
  .login-card {
    padding: 22px 20px
  }
}

/* Unterseite "Postfach scannen" (SPEC-001 Bauteil 1) */
.mailbox-page .section-head { align-items: flex-start; flex-wrap: wrap; gap: 12px }
.mailbox-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin: 14px 0 6px }
.mailbox-controls .field { flex: 1 1 220px; margin: 0 }
.mailbox-page .note { margin: 0 0 14px }
@media (max-width: 640px) { .mailbox-controls .btn { width: 100%; min-height: 44px } }
.chip.warn { background: #fff3cd; color: #664d03 }
