:root {
  color-scheme: light;
  --page: #f3f5f3;
  --surface: #fff;
  --ink: #1d332b;
  --muted: #68766f;
  --line: #e2e8e2;
  --green: #205b47;
  --green-deep: #153f36;
  --lime: #dcf3ac;
  --radius: 16px;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  color: var(--ink);
  background: var(--page);
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-size: 14px; line-height: 1.5; }
[hidden] { display: none !important; }
h1, h2, h3, p, dl, dd { margin: 0; }
button, input, select, textarea { font: inherit; }
button, input, select, textarea, .field { min-width: 0; }
button { cursor: pointer; }
button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
::selection { background: #d7ebbd; color: #173c2e; }

.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.eyebrow { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
:focus-visible { outline: 3px solid #86b964; outline-offset: 3px; }
.visually-hidden, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link:focus { position: fixed; top: 12px; left: 12px; z-index: 20; padding: 12px 20px; border-radius: 8px; background: #fff; color: var(--green); }

/* Grundelemente: große Eingabeflächen und eine klare Gewichtung der Aktionen. */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #eef3ee;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
  text-align: center;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
button:disabled { cursor: default; opacity: .48; }
button:not(:disabled):hover { background: #e2eae2; }
.button-primary { background: var(--green); color: white; }
.button-primary:not(:disabled):hover { background: var(--green-deep); box-shadow: 0 3px 8px #153f3614; }
.button-secondary { background: white; border-color: #dce4dc; }
.button-secondary:not(:disabled):hover { background: #f4f7f3; border-color: #aebeaf; }
.button-quiet { background: transparent; color: var(--muted); }
.button-quiet:not(:disabled):hover { color: var(--ink); background: #e9eee7; }
.button-link { min-height: 32px; padding: 4px 0 4px 8px; color: var(--green); background: none; font-size: 11px; }
.button-link:not(:disabled):hover { background: none; text-decoration: underline; text-underline-offset: 4px; }
.button-warm { background: #fbf0e9; color: #94552f; border-color: #f0e0d3; }
.button-warm:not(:disabled):hover { background: #f5e4d7; }
.button-lime { color: #35512a; background: #edf5df; }
.button-lime:not(:disabled):hover { background: #dfedc9; }
.button-danger { background: #fff4f2; color: #aa4438; }
.button-danger:not(:disabled):hover { background: #fbe5e0; }
.button-icon { width: 40px; padding: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; }
label { font-size: 12px; font-weight: 600; color: #53625b; }
input, select {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #dfe6de;
  border-radius: 8px;
  color: var(--ink);
  background-color: #fafcf9;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder, textarea::placeholder { color: #7a867f; opacity: 1; }
input:not(:disabled):hover, select:not(:disabled):hover { border-color: #b7c8b6; }
input:focus, select:focus, textarea:focus { border-color: #7fa083; outline: 2px solid #b9d8b64d; outline-offset: 1px; background-color: #fff; }
input:disabled, select:disabled { opacity: .6; cursor: default; }
select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23708273' stroke-width='1.8'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

/* Kopfbereich und Kennzahlen. */
.app { width: 100%; min-height: 100vh; min-height: 100dvh; padding: 0 clamp(16px, 3.2vw, 64px) 18px; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 84px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); font-size: 20px; font-weight: 750; letter-spacing: -.6px; flex-shrink: 0; }
.brand-mark { display: flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 12px; background: var(--green-deep); color: white; font-size: 29px; line-height: 1; font-weight: 750; letter-spacing: -3px; padding: 0 3px 5px 0; }
.brand-mark > span { color: var(--lime); }
.brand-suffix { font-weight: 400; }
.brand small { display: block; color: var(--muted); font-size: 10px; font-weight: 400; letter-spacing: .025em; margin-top: -3px; }
.account-tools { display: flex; align-items: center; justify-content: flex-end; gap: 16px; min-width: 0; }
.account-badge { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; min-width: 0; color: #56665a; }
#account-name { overflow-wrap: anywhere; }
.account-badge .icon { color: #7e9182; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 26px 0 22px; }
.page-heading .eyebrow { margin-bottom: 4px; }
.page-heading h1 { font-size: clamp(26px, 2.5vw, 34px); line-height: 1.2; letter-spacing: -.035em; font-weight: 650; }
.page-heading p:last-child { margin-top: 6px; color: var(--muted); font-size: 13px; }
#refresh { flex-shrink: 0; }
.balance-values { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 18px; margin-bottom: 24px; }
.balance-card { padding: 20px 24px; background: white; border: 1px solid var(--line); border-radius: 13px; }
.balance-card dt { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: #52635a; font-size: 12px; font-weight: 500; }
.balance-card dt .icon { color: #7d9484; }
.balance-card dd:not(.balance-caption) { font-size: clamp(26px, 2.4vw, 36px); line-height: 1.3; font-weight: 650; letter-spacing: -.04em; font-variant-numeric: tabular-nums; margin-top: 9px; overflow-wrap: anywhere; }
.balance-card .balance-caption { color: var(--muted); font-size: 11px; margin-top: 3px; }
.balance-card-primary { color: white; background: var(--green-deep); border-color: var(--green-deep); }
.balance-card-primary dt, .balance-card-primary .balance-caption { color: #c5d8cc; }
.balance-card-primary dt .icon { color: var(--lime); }

/* Links buchen, rechts den Abrechnungstext vorbereiten. */
.workspace { display: grid; flex: 1; grid-template-columns: minmax(340px, .85fr) minmax(0, 1.45fr); align-items: stretch; gap: 22px; }
.controls { display: grid; align-content: start; gap: 16px; min-width: 0; }
.panel { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 2px 3px #162e2202; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.panel-heading h2 { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 650; letter-spacing: -.015em; }
.panel-heading h2 .icon { color: #55816a; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.player-panel .field-row { grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); }
.player-balance-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 13px 0; padding: 9px 12px; border-radius: 7px; background: #f4f7f1; font-size: 11px; color: #637561; }
.currency-symbol { font-size: 15px; color: var(--green); font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; min-width: 0; }
.button-row { display: flex; gap: 10px; }
.button-row > button { flex: 1; }
.special-note { margin-bottom: 12px; }
.special-buttons { margin-top: 14px; }
.minus-symbol { font-size: 20px; line-height: .8; font-weight: 400; }
.team-action-row { display: flex; align-items: flex-end; gap: 12px; }
.team-amount-field { flex: 1; }
#apply-all { flex-shrink: 0; min-height: 42px; }
.balance-buttons { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
#happy-euro { flex: 1; }
#happy-euro span { font-size: 10px; font-weight: 400; opacity: .9; }

.ledger { display: flex; flex-direction: column; padding: 24px; }
.ledger-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.ledger-heading .eyebrow { margin-bottom: 3px; }
.ledger-heading h2 { font-size: 22px; font-weight: 650; letter-spacing: -.03em; }
.document-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; color: #6e7a6f; background: #f4f7ef; border: 1px solid #e6ebdf; border-radius: 6px; font-size: 11px; }
.document-badge .icon { width: 14px; height: 14px; }
.ledger-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 22px 0 20px; }
.ledger-filter { flex: 1; max-width: 200px; }
#export-text { min-height: 42px; }
.editor-sheet { display: flex; flex-direction: column; flex: 1; min-height: 360px; border: 1px solid #e1e7df; border-radius: 10px; overflow: hidden; }
.editor-meta { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; padding: 11px 18px; border-bottom: 1px solid #e9ede7; color: #74806f; font-size: 10px; background: #f8faf6; }
.editor-meta span:first-child { color: #586d53; font-weight: 600; }
.ledger-content { display: block; flex: 1; width: 100%; min-height: 300px; padding: 24px; margin: 0; resize: vertical; border: 0; border-radius: 0 0 10px 10px; background: white; color: #304b3e; font-size: 14px; line-height: 1.9; }
.ledger-content::placeholder { color: #849085; }
.ledger-content:focus { outline-offset: -3px; }
.ledger-footer { padding-top: 18px; }
.ledger-footer > p { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
.small-dot { width: 5px; height: 5px; flex: 0 0 auto; background: #8daa74; border-radius: 50%; }
.ledger-text-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
#copy-text { padding-inline: 20px; }
#download-text { margin-left: auto; }

/* Rückmeldungen und Datensicherung gehören zur Kasse, nicht ins Textdokument. */
.app-status { color: var(--green); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.app > .app-status { margin-top: 16px; padding: 10px 14px; border: 1px solid #dce7d5; border-radius: 8px; background: #ebf3e5; }
.app-status:empty { display: none; }
.app-status[data-error="true"] { color: #a13b31; background: #fff0ed; border-color: #f0d8d2; }
.data-tools { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-top: 16px; margin-top: auto; color: #6e7b71; }
.data-tools > span { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; }
.data-tools > span .icon { width: 15px; height: 15px; }
.data-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.data-actions button { font-size: 11px; min-height: 34px; padding: 7px 10px; }
.data-actions .icon { width: 15px; height: 15px; }

/* Anmeldung mit eigener, ruhiger Einstiegsfläche. */
.auth-panel { display: grid; grid-template-columns: 1fr 1fr; width: min(960px, calc(100% - 48px)); margin: max(32px, calc((100svh - 600px) / 2)) auto; border-radius: 22px; background: white; border: 1px solid #e0e6de; overflow: hidden; box-shadow: 0 24px 80px #243b2210; }
.auth-intro { position: relative; overflow: hidden; display: flex; flex-direction: column; padding: 40px; background: var(--green-deep); color: #fff; }
.brand-light { color: white; }
.brand-light .brand-mark { background: #ffffff12; border: 1px solid #ffffff1c; }
.auth-story { position: relative; z-index: 1; margin-top: 64px; max-width: 310px; }
.auth-story .eyebrow { color: #b9d792; }
.auth-story h2 { margin-top: 10px; font-size: clamp(34px, 4vw, 48px); font-weight: 550; line-height: 1.15; letter-spacing: -.055em; }
.auth-story > p:last-child { color: #c3d6ca; font-size: 14px; line-height: 1.9; max-width: 300px; margin-top: 18px; }
.auth-caption { display: flex; align-items: center; gap: 8px; z-index: 1; font-size: 11px; color: #cadfce; margin-top: auto; padding-top: 80px; }
.auth-caption .icon { width: 15px; height: 15px; color: var(--lime); }
.pitch-art { position: absolute; width: 420px; height: 300px; top: 390px; left: 160px; border: 1px solid #dbefcb18; border-radius: 8px; transform: rotate(-25deg); }
.pitch-art::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: #dbefcb18; }
.pitch-art::after { content: ""; position: absolute; top: 50%; left: 50%; width: 110px; height: 110px; border: 1px solid #dbefcb18; border-radius: 50%; transform: translate(-50%, -50%); }
.pitch-art span { position: absolute; top: 60px; left: -1px; width: 65px; height: 180px; border: 1px solid #dbefcb18; }
.auth-content { display: flex; flex-direction: column; justify-content: center; padding: 44px; }
.auth-content > .eyebrow { color: #6e8467; margin-bottom: 10px; }
.auth-content h1 { font-size: 26px; font-weight: 650; line-height: 1.3; letter-spacing: -.035em; }
.auth-description { color: var(--muted); font-size: 13px; line-height: 1.7; margin-top: 10px; }
#auth-form { display: flex; flex-direction: column; gap: 18px; margin-top: 26px; }
#auth-form input { min-height: 46px; }
#auth-submit { min-height: 46px; margin-top: 6px; }
.auth-content .app-status { padding: 12px 0 0; }
.auth-footnote { display: flex; align-items: center; gap: 7px; margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); font-size: 10px; color: var(--muted); }
.auth-footnote .icon { width: 14px; height: 14px; }

/* Mannschaftsdialog. */
dialog { width: min(730px, calc(100% - 32px)); max-height: calc(100svh - 48px); padding: 28px; border: 1px solid #dfe7dc; border-radius: 18px; color: var(--ink); background: white; box-shadow: 0 30px 100px #0e241a33; }
dialog::backdrop { background: #0e271d66; backdrop-filter: blur(4px); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.dialog-heading h2 { font-size: 24px; font-weight: 650; letter-spacing: -.03em; margin-top: 3px; }
.team-forms { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.team-forms form { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.team-forms form + form { border-left: 1px solid var(--line); padding-left: 24px; }
.team-forms h3 { font-size: 15px; margin-bottom: 8px; }
.team-forms input, .team-forms select { margin-bottom: 8px; }
.team-forms button { align-self: flex-start; margin-top: 6px; }
.form-description { color: var(--muted); font-size: 12px; margin-bottom: 14px; }
dialog .app-status { margin-top: 16px; padding: 10px; border-radius: 8px; }
.roster-heading { display: flex; align-items: center; justify-content: space-between; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.roster-heading h3 { font-size: 14px; }
#team-count { font-size: 11px; color: var(--muted); }
#team-list { list-style: none; padding: 0; margin: 10px 0 0; }
#team-list li { padding: 12px; border-bottom: 1px solid #e9eee5; background: #f8faf5; font-size: 12px; overflow-wrap: anywhere; }
#team-list li:first-child { border-radius: 8px 8px 0 0; }
#team-list li:last-child { border-bottom: 0; border-radius: 0 0 8px 8px; }

/* Die Anordnung folgt der verfügbaren Fläche schon beim ersten Laden. */
@media (min-width: 1700px) {
  .panel { padding: 26px; }
  .controls { gap: 20px; }
  .workspace { gap: 26px; }
  .ledger-content { padding: 32px; }
}
@media (max-width: 1050px) {
  .app { padding-inline: 22px; }
  .workspace { gap: 16px; grid-template-columns: minmax(320px, .9fr) minmax(0, 1fr); }
  .panel { padding: 18px; }
  .player-panel .field-row { grid-template-columns: minmax(0, 1fr) minmax(0, .8fr); }
  .button-row { gap: 8px; }
  .button-row button { padding-inline: 9px; font-size: 11px; }
  .ledger-toolbar { flex-wrap: wrap; }
  .ledger-filter { max-width: none; flex-basis: 100%; }
  #export-text { width: 100%; }
  #happy-euro span { display: none; }
}
@media (max-width: 760px) {
  .app { padding: 0 16px 16px; }
  .topbar { min-height: 76px; gap: 10px; }
  .brand { font-size: 18px; }
  .brand-mark { width: 36px; height: 36px; border-radius: 10px; font-size: 25px; }
  .account-tools { gap: 4px; }
  .account-badge .icon { display: none; }
  .account-badge { font-size: 10px; max-width: 140px; }
  #logout { padding-inline: 9px; font-size: 11px; }
  .page-heading { padding: 22px 0 18px; }
  .page-heading p:last-child { font-size: 12px; }
  .balance-values { gap: 10px; margin-bottom: 18px; }
  .balance-card { padding: 15px; }
  .balance-card dt { font-size: 11px; }
  .balance-card dt .icon { display: none; }
  .balance-card dd:not(.balance-caption) { font-size: 24px; }
  .balance-card .balance-caption { font-size: 10px; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .panel { padding: 22px; }
  .player-panel .field-row { grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); }
  .button-row button { padding-inline: 14px; font-size: 12px; }
  #happy-euro span { display: inline; }
  .ledger { min-height: 620px; }
  .ledger-toolbar { flex-wrap: nowrap; }
  .ledger-filter { max-width: 220px; flex: 1; }
  #export-text { width: auto; }
  .data-tools { align-items: flex-start; flex-direction: column; gap: 8px; }
  .data-actions { margin-left: -10px; }
  .auth-panel { width: min(500px, calc(100% - 32px)); margin: 24px auto; grid-template-columns: minmax(0, 1fr); }
  .auth-intro { padding: 28px; }
  .auth-story { margin-top: 30px; max-width: none; }
  .auth-story h2 { font-size: 36px; }
  .auth-story h2 br { display: none; }
  .auth-story > p:last-child { max-width: none; margin-top: 12px; font-size: 13px; }
  .auth-caption, .pitch-art { display: none; }
  .auth-content { padding: 28px; }
}
@media (max-width: 480px) {
  .account-badge { max-width: 100px; font-size: 9px; }
  .page-heading { flex-wrap: wrap; gap: 14px; }
  .page-heading h1 { font-size: 28px; }
  #refresh { font-size: 11px; min-height: 36px; padding: 8px 11px; }
  .balance-values { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .balance-card-primary { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto; gap: 0 12px; align-items: center; }
  .balance-card-primary dt { grid-column: 1; grid-row: 1; }
  .balance-card-primary dd:not(.balance-caption) { grid-column: 2; grid-row: 1 / 3; margin: 0; font-size: 30px; max-width: 100%; }
  .balance-card-primary .balance-caption { grid-column: 1; grid-row: 2; }
  .balance-card dd:not(.balance-caption) { font-size: 26px; }
  .panel { padding: 18px; }
  .panel-heading { gap: 2px; }
  .panel-heading h2 { font-size: 14px; }
  .button-link { font-size: 10px; }
  input, select, .ledger-content { font-size: 16px; }
  .player-panel .field-row { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); }
  .button-row button { padding: 10px 8px; font-size: 11px; }
  .button-row .icon { width: 15px; height: 15px; }
  .ledger-toolbar { flex-wrap: wrap; gap: 12px; }
  .ledger-filter { max-width: none; flex-basis: 100%; }
  #export-text { width: 100%; }
  .ledger-content { padding: 18px; font-size: 14px; }
  .ledger-footer > p { font-size: 9px; }
  .ledger-text-actions { gap: 6px; }
  .ledger-text-actions button { padding-inline: 10px; font-size: 11px; }
  #download-text { margin-left: 0; }
  #happy-euro { font-size: 11px; }
  #happy-euro span { font-size: 9px; }
  dialog { padding: 20px; }
  .team-forms { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .team-forms form + form { border-left: 0; border-top: 1px solid var(--line); padding: 20px 0 0; }
  .dialog-heading h2 { font-size: 20px; }
}
@media (max-width: 350px) {
  .account-badge { display: none; }
  .button-row { flex-direction: column; }
  .field-row, .player-panel .field-row { grid-template-columns: minmax(0, 1fr); }
  #happy-euro span { display: none; }
  .balance-card dd:not(.balance-caption) { font-size: 22px; }
  .balance-card-primary dd:not(.balance-caption) { font-size: 28px; }
  .ledger-text-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  #download-text { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
