:root {
  font: 16px/1.45 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color: #1f3958;
  background: #cee3f0;
  --ios-control: 44px;
  --ios-heading: 1.375rem;
  --ios-section: 1.0625rem;
  --ios-subheadline: .9375rem;
  --ios-switch: #408cbf;
  --ink: #1f3958;
  --muted: #516274;
  --card: #eff7fc;
  --border: #baceda;
  --accent: #deedf6;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

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

button,input,select,.download {
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  padding: .55rem .8rem;
}

button,.download {
  cursor: pointer;
}

button:hover,.download:hover {
  border-color: var(--ink);
}

button:focus-visible,input:focus-visible,select:focus-visible,a:focus-visible {
  outline: 3px solid #3577ad;
  outline-offset: 2px;
}

button:disabled {
  opacity: .55;
  cursor: default;
}

button.primary,nav button[aria-current=page] {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

label {
  display: grid;
  gap: .35rem;
  font-size: .88rem;
  font-weight: 600;
}

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

h1 {
  font-size: clamp(2rem,3.2vw,3rem);
  letter-spacing: -.048em;
  line-height: 1.12;
}

h2 {
  font-size: 1.15rem;
  letter-spacing: -.02em;
}

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

small {
  display: block;
  font-size: .85rem;
}

input,select {
  width: 100%;
  min-width: 0;
}

button {
  overflow-wrap: anywhere;
}

[hidden] {
  display: none!important;
}

#shell {
  display: grid;
  grid-template-columns: 210px minmax(0,1fr);
  min-height: 100vh;
}

aside {
  background: #e6f1f7;
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
  padding: 1.8rem 1rem;
  border-right: 1px solid var(--border);
}

.wordmark {
  font-weight: 730;
  font-size: 1.65rem;
  letter-spacing: -.065em;
}

aside .wordmark {
  padding-inline: .6rem;
}

nav {
  display: grid;
  gap: .25rem;
}

nav button {
  background: transparent;
  text-align: left;
  border-color: transparent;
  font-weight: 550;
  padding: .65rem .8rem;
}

.identity {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}

.identity button {
  display: block;
  font-size: .86rem;
  background: transparent;
  padding: 0;
  border: 0;
  color: var(--muted);
}

main {
  padding: clamp(1rem,3vw,3rem);
  max-width: 1550px;
  width: 100%;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(170px,.72fr) minmax(250px,1.4fr);
  gap: 1.25rem;
  align-items: start;
}

.workspace:has(.preview) {
  grid-template-columns: minmax(155px,.72fr) minmax(220px,1fr) minmax(240px,1.12fr);
}

.stack,.list,form {
  display: grid;
  align-content: start;
  gap: .8rem;
  min-width: 0;
}

.list {
  gap: .4rem;
}

.card,.login {
  background: var(--card);
  border-radius: 10px;
  padding: 1.15rem;
  display: grid;
  align-content: start;
  gap: .75rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.row {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 6px;
  background: rgba(243,249,252,.8);
  padding: .65rem .8rem;
}

.row[aria-pressed=true] {
  background: var(--ink);
  color: white;
}

.row[aria-pressed=true] small {
  color: #e1edf4;
}

.details-title {
  font-size: 1.5rem;
  letter-spacing: -.035em;
}

.drop {
  border: 1px dashed #7792a8;
  border-radius: 6px;
  padding: .8rem;
  background: #e7f2f9;
}

.drop.over {
  outline: 3px solid var(--ink);
}

.doc {
  display: block;
  text-align: left;
  width: 100%;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  padding: .6rem .1rem;
}

.preview img,.preview iframe {
  width: 100%;
  border: 0;
  border-radius: 6px;
}

.preview img {
  object-fit: contain;
  max-height: 65vh;
}

.preview iframe {
  height: 55vh;
}

.download {
  display: inline-block;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
}

.login {
  width: min(390px,calc(100% - 2rem));
  margin: 12vh auto 1rem;
  padding: 2rem;
}

.login form {
  margin-top: .7rem;
}

#status:not(:empty) {
  position: sticky;
  bottom: 0;
  padding: .75rem 1rem;
  background: #fff;
  color: var(--ink);
  border-top: 1px solid var(--border);
}

.personal {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(min(250px,100%),1fr));
  align-items: start;
  gap: 1rem;
}

.personal section p {
  white-space: pre-line;
}

.code {
  font: 600 1.5rem ui-monospace,monospace;
  letter-spacing: .15em;
}

.preserve {
  white-space: pre-line;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

@media(max-width:1090px) {
  #shell {
    grid-template-columns: 165px minmax(0,1fr);
  }
  .workspace:has(.preview) {
    grid-template-columns: minmax(150px,.7fr) minmax(220px,1.3fr);
  }
  .preview {
    grid-column: 2;
  }
}

@media(max-width:690px) {
  #shell {
    display: block;
  }
  aside {
    padding: .7rem 1rem;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: .6rem;
    border: 0;
    border-bottom: 1px solid var(--border);
  }
  aside .wordmark {
    padding: 0;
  }
  .identity {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
    padding: 0;
    border: 0;
  }
  #profiles,nav {
    grid-column: 1/-1;
  }
  nav {
    display: flex;
    flex-wrap: wrap;
  }
  main {
    padding: 1rem;
  }
  .workspace,.workspace:has(.preview) {
    grid-template-columns: 1fr;
  }
  .preview {
    grid-column: 1;
  }
  .list {
    max-height: 15rem;
    overflow: auto;
  }
  button,input,select {
    min-height: 44px;
  }
  .identity button {
    min-height: 0;
  }
  .login {
    margin-top: 5vh;
  }
}

.preview canvas {
  display: block;
  width: 100%;
  height: auto;
  background: white;
}

.preview .actions {
  align-items: center;
  justify-content: space-between;
}

.preview .actions button {
  font-size: .84rem;
}

.list-heading {
  font-size: .86rem;
  color: var(--muted);
  margin: .6rem 0 .1rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  padding: 1.35rem 1.5rem;
}
.summary h2 { font-size: 1rem; }
.total {
  display: block;
  font-size: clamp(2.1rem, 4vw, 3.2rem);
  line-height: 1.2;
  letter-spacing: -.045em;
  font-variant-numeric: tabular-nums;
}
.periods {
  display: flex;
  flex-wrap: wrap;
  padding: 3px;
  gap: 2px;
  background: var(--accent);
  border-radius: 8px;
}
.periods button {
  font-size: .85rem;
  background: transparent;
  border: 1px solid transparent;
  padding: .4rem .55rem;
}
.periods button[aria-pressed=true] { background: white; border-color: var(--border); }
.row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: .1rem .6rem;
}
.row small { grid-column: 1/-1; }
.row-amount { font-size: .9rem; text-align: right; font-variant-numeric: tabular-nums; }
.detail-amount { font-size: 1.3rem; }
.euro-field {
  display: flex;
  align-items: center;
  width: fit-content;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding-right: .7rem;
}
.euro-field input { border: 0; width: 9em; text-align: right; }
.card form > button { justify-self: start; }
.drop { width: 100%; text-align: center; justify-items: center; padding: 1.3rem; gap: .25rem; border-radius: 10px; }
.drop strong { font-size: 1.05rem; }
.doc { border: 1px solid var(--border); border-radius: 6px; padding: .55rem .7rem; }
.doc[aria-pressed=true] { color: white; background: var(--ink); border-color: var(--ink); }
.doc[aria-pressed=true]::after { content: 'In Vorschau'; display: block; font-size: .78rem; color: #e1edf4; }
.identity button { padding: .25rem 0; }
.identity button[aria-current=page] { color: var(--ink); text-decoration: underline; }

.summary.income { background: #e0eef7; }
.summary h2 { font-weight: 550; color: var(--muted); }
.total { font-weight: 560; }
.settings form { grid-template-columns: 1fr 1fr; }
.settings form > * { grid-column: 1/-1; }
.settings form > [data-field=firstName],.settings form > [data-field=postalCode] { grid-column: 1; }
.settings form > [data-field=lastName],.settings form > [data-field=city] { grid-column: 2; }
@media(min-width:691px) {
  aside { position: sticky; top: 0; height: 100vh; overflow: auto; }
}
@media(max-width:410px) {
  .row { grid-template-columns: minmax(0,1fr) auto; }
}

.fee-card,.product-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: baseline;
  text-align: left;
  font-size: 1rem;
  width: 100%;
}
.fee-card { font-weight: 600; border: 1px solid transparent; }
.fee-card small,.product-row small { grid-column: 1/-1; font-weight: 400; }
.text-action { justify-self: start; }
.documents .doc {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  height: 44px;
  padding: 0 .75rem;
}
.documents .doc span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.documents .doc[aria-pressed=true]::after { flex: 0 0 auto; }
.documents .drop { height: 44px; gap: 0; align-content: center; padding: 0 .5rem; border-radius: 6px; font-size: .85rem; }
.documents .drop small { font-size: .73rem; }
.editor {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  width: min(29rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: 1.5rem;
  box-shadow: 0 12px 44px #15324f38;
}
.editor::backdrop { background: #17314b55; }
.editor h2 { margin: 0 0 1.2rem; font-size: 1.35rem; }
.editor form { gap: 1rem; }
.editor .choices { border: 0; margin: 0; padding: 0; }
.choices legend { padding: 0; margin-bottom: .35rem; font-size: .88rem; font-weight: 600; }
.choices-line,.editor-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.choices-line button { flex: 1; padding: .5rem .4rem; font-size: .9rem; }
.choices-line [aria-pressed=true] { background: var(--ink); color: white; }
.editor-actions { justify-content: flex-end; padding-top: .6rem; }
.editor-error { margin: 0; color: #943e2e; }
.editor-error:empty { display: none; }
.editor textarea { font: inherit; border: 1px solid var(--border); border-radius: 6px; padding: .6rem; }
.editor label:has(input[type=checkbox]) { display: flex; align-items: center; gap: .7rem; }
.editor input[type=checkbox] { width: auto; }
body[data-background=sky] { background:linear-gradient(160deg,#b4d9ee,#f5f9fb); }
body[data-background=sand] { background:#ece4d7; }
.editor { overflow:auto; }
.editor-actions { position:sticky; bottom:-1.5rem; background:var(--card); padding-bottom:.65rem; }
.editor textarea { width:100%; min-height:4em; }
.card details { padding:.4rem 0; }
.card summary { cursor:pointer; }
body { min-height:100vh; }
.editor .preserve { max-height:25vh; overflow:auto; }

.group-heading,.switch-row,.departure-reason,.tax-row { display:flex; align-items:center; justify-content:space-between; gap:8px }
.group-heading .list-heading { margin:0; color:var(--ink); font-size:var(--ios-section); font-weight:600 }
.group-heading { margin-top:8px; min-height:var(--ios-control) }
.section-add,.inline-info { padding:0; width:var(--ios-control); height:var(--ios-control); color:var(--ink); background:transparent; border:0 }
.section-add { font-size:var(--ios-heading); font-weight:600; line-height:1 }
.section-add:active,.inline-info:active { opacity:.7 }
.folder-identity { display:grid; gap:0 }
.folder-identity .identity-card { display:grid; grid-template-columns:1fr auto; align-items:baseline; gap:6px; padding:0; border:0; background:transparent; text-align:left; width:100%; color:inherit; font-weight:inherit }
.identity-card .details-title,.identity-card .detail-amount { font-size:var(--ios-section); font-weight:600 }
.identity-card small,.identity-card p { grid-column:1/-1 }
.tax-row,.departure-reason { min-height:var(--ios-control); border-top:1px solid var(--border) }
.tax-row { margin-top:8px; justify-content:flex-start; gap:4px; font-size:var(--ios-subheadline) }
.tax-row label { font-size:inherit; font-weight:400 }
.tax-row > :last-child { margin-left:auto }
.inline-info { display:grid; place-items:center; flex:none }
.inline-info span { display:grid; place-items:center; width:13px; height:13px; border:1px solid currentColor; border-radius:50%; font:600 10px/1 Georgia,serif }
.tax-help button { margin-top:16px }
.switch-row,.departure-reason { min-height:var(--ios-control); font-weight:400; font-size:var(--ios-section) }
input[role=switch] { appearance:none; width:63px; height:28px; min-height:0; flex:none; padding:3px; border:0; border-radius:20px; background:#adb7c0; cursor:pointer }
input[role=switch]::before { display:block; content:""; width:37px; height:22px; border-radius:16px; background:white; box-shadow:0 1px 3px #0002 }
input[role=switch]:checked { background:var(--ios-switch) }
input[role=switch]:checked::before { transform:translateX(20px) }
.departure textarea { width:100%; font:inherit; color:inherit; background:transparent; border:0; padding:8px 0; resize:vertical }
.departure-hint { font-size:var(--ios-subheadline); color:var(--muted) }
.value-browser { width:min(960px,94vw); max-width:94vw }
.value-browser iframe { width:100%; height:clamp(180px,36vh,480px); border:1px solid #d1dce4; border-radius:6px; background:white }
.value-browser .browser-bar { display:flex; align-items:end; gap:6px; margin:12px 0 }
.browser-bar label { flex:1; min-width:0 }
.evidence-form { display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); gap:10px; align-items:end; margin-top:12px }

.identity-meta { grid-column:1/-1; display:flex; justify-content:space-between; align-items:center; min-height:var(--ios-control); gap:12px; color:var(--muted); font-size:var(--ios-subheadline) }
.settings-screen { width:min(100%,660px); display:grid; gap:18px; margin:0 auto; align-content:start }
.settings-header { display:grid; grid-template-columns:1fr auto 1fr; align-items:center; min-height:44px }
.settings-header h2 { grid-column:2; grid-row:1; text-align:center; margin:0; font-size:var(--ios-section) }
.back-link { justify-self:start; grid-column:1; grid-row:1; color:var(--ink); background:transparent; border:0; padding-left:0 }
.settings-group { padding:0 16px; display:grid; gap:0 }
.settings-link { background:transparent; width:100%; border:0; text-align:left; min-height:48px; border-radius:0; padding:8px 2px; font-size:var(--ios-section) }
.settings-link + .settings-link { border-top:1px solid var(--border) }
.settings-link:hover { color:var(--ink); background:var(--accent) }
.settings-screen > .personal { grid-template-columns:1fr }
.archive-row small.file-count { grid-column:2; grid-row:1; text-align:right }
.archive-row small.archive-date { grid-column:1/-1 }
.archive .row { min-height:68px; padding:.7rem 1rem }

.workspace.archive.without-selection { display:block; width:min(100%,660px); margin-inline:auto }
.workspace.archive.without-selection > .stack:empty { display:none }
.archive-row:not([aria-pressed=true]) { background:var(--card); color:var(--ink) }
