:root {
  font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-size: 14px;
  font-synthesis: none;
  --muted: #73747c;
  --line: #e9e9ed;
  --blue: #0071e3;
  --ink: #1d1d1f;
  --canvas: #f5f5f7;
  --surface: #fff;
  --side: #f0f0f3;
  --subtle: #f3f5f8;
  --accent: #e0ecfc;
  --link-color: #125eb2;
  --good: #237044;
  --bad: #a5282d;
  --success-bg: #eaf5ee;
  --error-bg: #fff1f0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,input,select,textarea,summary {
  font: inherit;
}

button,a,input,select,textarea,summary {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
  font-weight: 550;
  white-space: nowrap;
  transition: background .15s,box-shadow .15s;
}

button:disabled {
  opacity: .5;
  cursor: wait;
}

a {
  color: var(--link-color);
  text-decoration: none;
}

button:focus-visible,a:focus-visible,summary:focus-visible {
  outline: 3px solid #77b5ff;
  outline-offset: 3px;
}

input:focus,select:focus,textarea:focus {
  outline: 3px solid #0071e326;
  border-color: #5195df;
}

h1,h2,h3,h4,p {
  margin: 0;
}

h1 {
  font-size: 38px;
  font-weight: 650;
  letter-spacing: -1.3px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -.3px;
}

h3 {
  font-size: 14px;
  font-weight: 650;
}

h4 {
  font-size: 14px;
}

small {
  font-size: 11px;
}

.muted,.field-hint {
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none!important;
}

.sidebar {
  width: 224px;
  position: fixed;
  inset: 0 auto 0 0;
  background: var(--side);
  border-right: 1px solid var(--line);
  padding: 35px 20px;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-size: 20px;
  letter-spacing: -.7px;
  font-weight: 650;
  padding: 0 8px;
}

.brand-mark {
  display: grid;
  place-items: center;
  background: #252529;
  color: white;
  border-radius: 12px;
  width: 37px;
  height: 37px;
  font-size: 22px;
  font-weight: 500;
}

.brand-sub {
  display: block;
  font-size: 11px;
  letter-spacing: .25px;
  color: var(--muted);
  font-weight: 400;
  margin-top: 3px;
}

.nav-label {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--muted);
  font-weight: 650;
  margin: 49px 12px 12px;
}

.workspace-nav {
  display: grid;
  gap: 4px;
}

.workspace-link {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 10px 12px;
}

.workspace-link:hover,.workspace-link[aria-current] {
  background: var(--accent);
  color: var(--link-color);
}

.workspace-link span {
  font-size: 17px;
  line-height: 1;
}

.local-note {
  margin-top: auto;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.8;
  padding: 0 9px;
}

.local-note small {
  display: block;
  margin-left: 13px;
  font-size: 10px;
  color: var(--muted);
}

.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #a6a6ad;
  border-radius: 50%;
  margin-right: 7px;
}

.status-dot.connected {
  background: #349568;
}

main {
  margin-left: 224px;
  padding: 56px 46px 26px;

}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 36px;
  gap: 20px;
}

.eyebrow {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin-bottom: 10px;
}

.subtitle {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.primary,.secondary,.danger {
  border-radius: 8px;
  padding: 10px 16px;
  border: 1px solid transparent;
  min-height: 39px;
}

.primary {
  background: var(--blue);
  color: white;
  box-shadow: 0 1px 2px #0000000a;
}

.primary:hover {
  background: #0077ed;
}

.secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.secondary:hover {
  background: var(--canvas);
}

.danger {
  color: var(--bad);
  background: none;
  padding-left: 0;
}

.danger:hover {
  color: var(--bad);
}

.text-button {
  color: var(--link-color);
  background: none;
  border: 0;
  padding: 5px 0;
  font-size: 12px;
}

.icon-button {
  border: 0;
  background: var(--subtle);
  border-radius: 50%;
  color: var(--muted);
  font-size: 23px;
  width: 29px;
  height: 29px;
  line-height: 1;
}

.workspace {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 3px 14px #1d1d1f03;
  overflow: hidden;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.workspace>.section-heading {
  padding: 23px 24px 20px;
}

.section-heading>.muted {
  font-size: 11px;
}

.count {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: var(--subtle);
  border-radius: 5px;
  padding: 2px 7px;
  margin-left: 6px;
  vertical-align: middle;
}

.filters {
  display: flex;
  gap: 9px;
  padding: 0 24px 22px;
  align-items: center;
  flex-wrap: wrap;
}

.filters label {
  margin: 0;
}

.filters select,.filters input {
  min-height: 35px;
  font-size: 12px;
  background: var(--subtle);
}

.filters select {
  min-width: 145px;
}

.filters .secondary {
  min-height: 35px;
  padding: 7px 13px;
  font-size: 12px;
}

.search {
  flex: 1;
  position: relative;
  min-width: 185px;
}

.search>span:first-child {
  position: absolute;
  top: 5px;
  left: 11px;
  color: var(--muted);
  font-size: 21px;
  line-height: 1;
}

.search input {
  padding-left: 32px;
  width: 100%;
}

.filters .text-button {
  color: var(--muted);
  padding: 8px 3px;
  font-size: 11px;
}

.list-footer {
  padding: 16px 24px;
  color: var(--muted);
  font-size: 11px;
  border-top: 1px solid var(--line);
}

.loading {
  padding: 70px 25px;
  text-align: center;
  color: var(--muted);
}

.empty-state {
  text-align: center;
  padding: 66px 24px 72px;
  border-top: 1px solid var(--line);
}

.empty-icon {
  font-size: 28px;
  color: var(--muted);
  display: grid;
  place-items: center;
  background: var(--subtle);
  width: 61px;
  height: 61px;
  border-radius: 18px;
  margin: 0 auto 18px;
}

.empty-state h3 {
  font-size: 17px;
  margin-bottom: 9px;
}

.empty-state p {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 22px;
  line-height: 1.6;
}

.search-hint {
  padding: 0 24px 18px;
  margin-top: -8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.overview-facts {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 7px 10px;
  margin: 3px 0 0;
  font-size: 11px;
  line-height: 1.5;
}

.overview-facts dt {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.overview-facts dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.error,.notice {
  border-radius: 8px;
  padding: 12px 14px;
  line-height: 1.6;
  font-size: 12px;
  margin-bottom: 18px;
  overflow-wrap: anywhere;
}

.error {
  background: var(--error-bg);
  border: 1px solid #f5d4d2;
  color: var(--bad);
}

.notice {
  background: var(--success-bg);
  color: var(--good);
  border: 1px solid #d1e7d9;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0;
  width: 760px;
  max-width: calc(100vw - 36px);
  max-height: calc(100dvh - 54px);
  color: inherit;
  box-shadow: 0 20px 100px #0003;
  overflow: auto;
}

dialog::backdrop {
  background: #20243145;
  backdrop-filter: blur(5px);
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 23px 28px 20px;
  border-bottom: 1px solid var(--line);
  gap: 12px;
}

.dialog-header h2 {
  font-size: 22px;
  letter-spacing: -.6px;
}

.dialog-header .eyebrow {
  margin-bottom: 6px;
  font-size: 9px;
}

.dialog-body {
  padding: 22px 28px;
}

.form-intro {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 24px;
}

.required {
  color: var(--muted);
}

.form-section+.form-section {
  margin-top: 25px;
  padding-top: 25px;
  border-top: 1px solid var(--line);
}

.form-section h3 {
  margin-bottom: 17px;
}

.form-section>.section-heading {
  margin-bottom: 17px;
}

.form-section>.section-heading h3 {
  margin: 0;
}

.optional {
  font-size: 10px;
  font-weight: 400;
  color: var(--muted);
  margin-left: 6px;
}

label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.5;
}

input,select,textarea,summary {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  min-width: 0;
  width: 100%;
  min-height: 39px;
  color: var(--ink);
  padding: 9px 11px;
  transition: border-color .15s;
}

label>input,label>select,label>textarea,label>.money-input {
  margin-top: 7px;
}

input::placeholder,textarea::placeholder {
  color: var(--muted);
  font-weight: 400;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

input[readonly] {
  background: var(--subtle);
  color: var(--link-color);
  cursor: pointer;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

.article-combobox {
  position: relative;
}

.article-combobox > input {
  margin-top: 7px;
}

.article-options {
  position: absolute;
  z-index: 4;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: 0 6px 20px #0001;
}

.article-option {
  padding: 10px;
  border-radius: 5px;
  cursor: pointer;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.article-option[aria-selected="true"], .article-option:hover {
  background: var(--accent);
  color: var(--link-color);
}

.input-action {
  display: flex;
  gap: 7px;
  margin-top: 7px;
  align-items: flex-start;
}

.input-action>input,.input-action>select,.input-action>#shop-picker {
  flex: 1;
  min-width: 0;
}

.add-button {
  height: 39px;
  width: 37px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--subtle);
  font-size: 19px;
  color: var(--muted);
}

.add-button:hover {
  background: var(--accent);
  color: var(--link-color);
}

details {
  position: relative;
}

summary {
  cursor: pointer;
  line-height: 19px;
  list-style: none;
  font-size: 13px;
  padding-right: 25px;
  position: relative;
}

summary::-webkit-details-marker {
  display: none;
}

summary:after {
  content: "⌄";
  position: absolute;
  right: 10px;
  color: var(--muted);
}

summary span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-options {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  top: 44px;
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: 0 6px 20px #0001;
  background: var(--surface);
  padding: 6px;
  max-height: 210px;
  overflow-y: auto;
}

#shop-picker { position: relative; }
#shop-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 39px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--subtle);
  text-align: left;
  font-size: 13px;
}
#shop-summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop-option { display: flex; align-items: center; gap: 6px; }
.shop-option label { flex: 1; min-width: 0; }
.shop-remove {
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  min-height: 32px;
  padding: 6px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}
.shop-remove:hover { background: var(--error-bg); color: var(--bad); }
.shop-remove svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; }

.shop-options:empty:after {
  content: "Noch keine Shops. Mit ＋ hinzufügen.";
  display: block;
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
}

.shop-options label {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px;
  border-radius: 4px;
  color: var(--ink);
  cursor: pointer;
  overflow-wrap: anywhere;
}

.shop-options label:hover {
  background: var(--subtle);
}

.shop-options input {
  width: 15px;
  min-height: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--blue);
  flex-shrink: 0;
}

.price-grid {
  display: grid;
  grid-template-columns: .6fr 1fr 1fr;
  gap: 16px;
}

.money-input {
  display: flex;
  align-items: center;
  position: relative;
}

.money-input input {
  padding-right: 28px;
}

.money-input>span {
  position: absolute;
  right: 11px;
  color: var(--muted);
  font-size: 12px;
  pointer-events: none;
}

.field-hint {
  font-size: 10px;
  line-height: 1.6;
  margin-top: 8px;
  font-weight: 400;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.ticket-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 5px;
  font-size: 10px;
  background: var(--accent);
  color: var(--link-color);
  padding: 4px 7px;
}

.chip button {
  border: 0;
  background: none;
  color: inherit;
  font-size: 14px;
  padding: 0;
  line-height: 1;
}

.dialog-footer {
  padding: 17px 28px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 15px;
  background: var(--surface);
  position: sticky;
  bottom: 0;
  z-index: 3;
}

.footer-right {
  display: flex;
  gap: 9px;
  margin-left: auto;
}

.dialog-footer button {
  font-size: 12px;
}

.calculator {
  margin-top: 17px;
  padding: 18px;
  border-radius: 10px;
  background: var(--accent);
  border: 1px solid var(--line);
}

.calculator h4 {
  color: var(--link-color);
}

.calculator .field-hint {
  margin-top: 5px;
}

.calculator-row {
  display: grid;
  grid-template-columns: 1fr .65fr 1fr;
  gap: 12px;
  align-items: end;
  margin-top: 15px;
}

.calculator-row>.shop-name {
  font-size: 12px;
  color: var(--muted);
  align-self: center;
  overflow-wrap: anywhere;
}

.calculator-row label {
  font-size: 10px;
}

.calculator-row input {
  font-size: 12px;
}

.calculation-result {
  font-size: 12px;
  line-height: 1.8;
  color: var(--link-color);
  margin-top: 16px;
  font-variant-numeric: tabular-nums;
}

.calculator-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 15px;
}

.calculator-actions button {
  font-size: 11px;
  padding: 8px 12px;
  min-height: 33px;
}

.calculator .error {
  margin: 12px 0 0;
}

.small-dialog {
  width: 400px;
}

.small-dialog .dialog-header h2 {
  font-size: 19px;
}

.small-dialog .field-hint {
  margin-top: 12px;
}

.small-dialog .error {
  margin: 12px 0 0;
}

@media(min-width:1500px) {
  main {
    padding-inline: 36px;
  }
}

@media(max-width:1150px) {
  .sidebar {
    width: 190px;
    padding-inline: 16px;
  }
  main {
    margin-left: 190px;
    padding: 40px 26px;
  }
  .filters {
    padding-inline: 20px;
  }
  .section-heading>.muted {
    font-size: 10px;
  }
}

@media(max-width:800px) {
  .sidebar {
    width: 100%;
    height: 67px;
    position: static;
    flex-direction: row;
    align-items: center;
    padding: 14px 22px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: var(--canvas);
  }
  .brand {
    font-size: 16px;
    padding: 0;
    gap: 9px;
  }
  .brand-mark {
    width: 31px;
    height: 31px;
    border-radius: 9px;
    font-size: 18px;
  }
  .brand-sub {
    font-size: 9px;
  }
  .nav-label,.local-note {
    display: none;
  }
  .workspace-nav {
    display: flex;
    margin-left: auto;
  }
  .workspace-link {
    padding: 8px;
    font-size: 12px;
  }
  main {
    margin-left: 0;
    padding: 32px 20px;
  }
  .page-header {
    margin-bottom: 25px;
    align-items: flex-end;
  }
  .eyebrow {
    font-size: 9px;
    letter-spacing: 1.1px;
  }
  h1 {
    font-size: 31px;
  }
  .subtitle {
    font-size: 12px;
    max-width: 240px;
    line-height: 1.5;
  }
  .page-header>.primary {
    font-size: 12px;
    padding: 9px 12px;
  }
  .workspace>.section-heading {
    padding: 20px;
  }
  .workspace h2 {
    font-size: 16px;
  }
  .filters {
    gap: 8px;
  }
  .filters>label:not(.search) {
    flex: 1;
    min-width: calc(50% - 8px);
  }
  .filters select {
    min-width: 0;
  }
  .search {
    flex-basis: 100%;
  }
  .filters .text-button {
    margin-left: auto;
  }
  .list-footer {
    padding: 14px 20px;
    line-height: 1.6;
  }
  .empty-state {
    padding: 50px 20px;
  }
  .section-heading>.muted {
    font-size: 9px;
  }
  .dialog-body {
    padding: 20px 24px;
  }
  .dialog-header {
    padding: 21px 24px 18px;
  }
}

@media(max-width:540px) {
  .search-hint {
    padding-inline: 16px;
  }
  main {
    padding: 28px 16px;
  }
  .sidebar {
    padding-inline: 20px;
  }
  .subtitle {
    max-width: 210px;
    font-size: 11px;
  }
  .page-header {
    gap: 10px;
  }
  .page-header>.primary {
    padding: 9px 10px;
  }
  .workspace>.section-heading,.filters {
    padding-inline: 16px;
  }
  .workspace>.section-heading {
    gap: 8px;
  }
  .section-heading>.muted {
    max-width: 106px;
    text-align: right;
    line-height: 1.5;
  }
  .form-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .price-grid {
    grid-template-columns: 1fr 1fr;
    gap: 15px 12px;
  }
  .price-grid>label:first-child {
    grid-column: 1/-1;
  }
  .price-grid label {
    font-size: 11px;
  }
  dialog {
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 20px);
    border-radius: 13px;
  }
  .dialog-header {
    padding: 20px;
  }
  .dialog-body {
    padding: 20px;
  }
  .dialog-footer {
    padding: 13px 16px;
    gap: 8px;
  }
  .dialog-footer button {
    padding: 9px 10px;
    font-size: 11px;
  }
  .dialog-footer .danger {
    padding-left: 0;
  }
  .footer-right {
    gap: 7px;
  }
  .form-section>.section-heading {
    align-items: flex-start;
    gap: 8px;
  }
  .form-section .text-button {
    font-size: 11px;
    padding: 0;
  }
  .calculator {
    padding: 13px;
  }
  .calculator-row {
    grid-template-columns: .7fr 1fr;
    gap: 8px;
  }
  .calculator-row>.shop-name {
    grid-column: 1/-1;
  }
  .calculator-row input {
    font-size: 13px;
  }
  .calculator-actions button {
    font-size: 11px;
  }
  .field-hint {
    font-size: 10px;
  }
  .page-footnote {
    font-size: 10px;
  }
}

@media(prefers-reduced-motion:reduce) {
  * {
    transition: none!important;
  }
}

#bookings-content { border: 0; padding: 0; margin: 0; min-width: 0; }
#bookings-title { overflow-wrap: anywhere; }
.booking-breadcrumb {
  color: var(--muted);
  margin-bottom: 12px;
  overflow-wrap: anywhere;
}

#bookings-view .subtitle {
  max-width: none;
  margin: 6px 0 16px;
}

#bookings-view > .error,
#bookings-view > .notice { margin: 16px 0; }

.booking-balance,
.booking-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

.booking-balance {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.booking-balance > div + div {
  border-left: 1px solid var(--line);
  padding-left: 12px;
}

.booking-balance dt { color: var(--muted); }
.booking-balance dd { margin: 4px 0 0; font-size: 24px; font-weight: 650; }

.booking-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.booking-panel > .field-hint { margin: 8px 0; }
.booking-panel button { white-space: normal; }
.booking-history > summary { border: 0; background: none; }
.booking-history > .muted { margin-top: 10px; }

@media(max-width: 650px) {
  .booking-panels { grid-template-columns: minmax(0, 1fr); }
  .booking-balance { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .booking-balance > div:nth-child(3) { border-left: 0; padding-left: 0; }
}

@media(max-width: 370px) {
  .workspace-link span { display: none; }
  .sidebar { padding-inline: 12px; }
}
.booking-heading { margin: 24px 0 12px; }
.booking-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 12px 0; overflow-wrap: anywhere; }
.booking-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin: 14px 0; }
.booking-form label { flex: 1 1 180px; min-width: 0; }
.booking-form select { width: 100%; }
.booking-form .field-hint { flex-basis: 100%; }
#bookings-content > button { margin: 6px 8px 6px 0; }
#bookings-content .overview-facts { margin: 14px 0; }
@media(max-width: 600px) {
  .booking-form > button { flex: 1 1 auto; }
  .booking-form label { flex-basis: 100%; }
  #bookings-content > button { max-width: 100%; white-space: normal; }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f0f2f5;
  --muted: #aeb8c7;
  --line: #424955;
  --canvas: #17191d;
  --surface: #22262d;
  --side: #1e2127;
  --subtle: #2b303a;
  --accent: #203956;
  --link-color: #8ec6ff;
  --good: #8ae3ac;
  --bad: #ffaaa7;
  --success-bg: #193629;
  --error-bg: #442729;
}

:root[data-theme="light"] { color-scheme: light; }

#theme-toggle { margin-top: auto; text-align: left; }
.local-note { margin-top: 14px; }
#theme-toggle[aria-pressed="true"], #deal-months [aria-pressed="true"] {
  background: var(--accent);
  color: var(--link-color);
  border-color: var(--link-color);
}

main { padding-block-start: clamp(24px, 3vw, 48px); }
.page-header { margin-bottom: 22px; }
.month-overview { margin-bottom: 16px; }
#deal-months { display: flex; gap: 8px; overflow-x: auto; padding: 4px; margin: -4px -4px 10px; }
#deal-months:empty { display: none; }
.month-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 26px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.month-summary strong, .deal-profit strong { display: block; font-size: clamp(21px, 2vw, 32px); }
.profit { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.gain { color: var(--good); }
.loss { color: var(--bad); }

#deal-list { display: grid; gap: 14px; padding: 0 20px 20px; }
.deal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 17px;
  box-shadow: 0 2px 5px #00000012;
  overflow-wrap: anywhere;
}
.deal-card-details {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr) minmax(0, .9fr) minmax(0, .8fr);
  gap: 16px;
  align-items: start;
}
.deal-card-details > * + * { border-left: 1px solid var(--line); padding-left: 16px; }
.deal-identity h3 { font-size: 17px; margin-bottom: 7px; }
.deal-card .overview-facts, .shipment-detail .overview-facts { font-size: 14px; }
.deal-action-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.deal-action-buttons a { display: inline-flex; align-items: center; font-weight: 550; }
.deal-card > .muted { margin-top: 12px; }
.deal-calculation { margin: 4px 0 0; padding-left: 20px; display: flex; flex-wrap: wrap; gap: 4px 26px; }

.shipment-layout { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr); align-items: start; gap: 18px; margin-top: 16px; }
.shipment-layout.overview { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.shipment-layout h2 { margin-bottom: 12px; overflow-wrap: anywhere; }
.shipment-cards { display: grid; gap: 10px; margin-top: 12px; }
.shipment-card { border: 1px solid var(--line); background: var(--subtle); border-radius: 10px; padding: 14px; }
.shipment-card.selected { border-color: var(--link-color); background: var(--accent); }
.shipment-card-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.shipment-card-heading h2 { margin-bottom: 0; }
.shipment-card-heading button { white-space: normal; overflow-wrap: anywhere; text-align: left; font-size: 15px; }
.shipment-card p { margin-top: 5px; }
.shipment-badge { padding: 5px 9px; border-radius: 7px; font-weight: 650; background: var(--surface); border: 1px solid var(--line); }
.shipment-badge.active { background: var(--accent); color: var(--link-color); }
.shipment-badge.delivered { background: var(--success-bg); color: var(--good); }
.shipment-badge.problem { background: var(--error-bg); color: var(--bad); }
.shipment-total { border-top: 1px solid var(--line); padding-top: 12px; display: flex; justify-content: space-between; gap: 12px; align-items: center; font-size: 18px; font-weight: 650; }

@media(max-width: 1050px) {
  .deal-card-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .deal-card-details > :nth-child(3) { border-left: 0; padding-left: 0; }
}
@media(max-width: 800px) {
  #theme-toggle { margin: 0 0 0 8px; padding: 6px 8px; min-height: 32px; font-size: 11px; }
  .sidebar { height: auto; min-height: 67px; flex-wrap: wrap; }
  .shipment-layout, .shipment-layout.overview { grid-template-columns: minmax(0, 1fr); }
  .shipment-sidebar { order: 1; }
}
@media(max-width: 520px) {
  #deal-list { padding-inline: 12px; }
  .deal-card-details { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .deal-card-details > * + * { border-left: 0; padding-left: 0; padding-top: 8px; border-top: 1px solid var(--line); }
  .deal-action-buttons { justify-content: flex-start; }
  .deal-action-buttons > * { white-space: normal; }
}

.workspace-back { margin-bottom: 14px; }
.dashboard-panel { margin-top: 16px; }
.dashboard-panel > .muted { margin-top: 8px; }
.dashboard-empty { margin-top: 18px; font-weight: 600; }
.dashboard-shipment .primary { margin-top: 10px; }
.booking-panel > .shipment-card { margin-top: 10px; }
.calendar-panel { margin-top: 16px; }
.calendar-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.calendar-toolbar h2 { margin-right: auto; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; margin-top: 14px; }
.calendar-weekday { color: var(--muted); font-weight: 600; padding: 4px 8px; }
.calendar-day { min-height: 86px; background: var(--subtle); padding: 8px; border: 1px solid var(--line); border-radius: 7px; }
.calendar-day.has-eta { background: var(--surface); }
.calendar-event { display: block; width: 100%; margin-top: 6px; padding: 6px; border: 0; border-radius: 5px;
  background: var(--accent); color: var(--link-color); white-space: normal; overflow-wrap: anywhere; text-align: left; }
.calendar-event:hover { text-decoration: underline; }
@media(max-width: 800px) {
  .workspace-nav { flex-wrap: wrap; }
  .calendar-grid { grid-template-columns: minmax(0, 1fr); }
  .calendar-weekday, .calendar-blank, .calendar-day:not(.has-eta) { display: none; }
  .calendar-day { min-height: 0; }
}

.workspace-link svg { flex-shrink: 0; }
.workspace-link .nav-badge {
  margin-left: auto; padding: 2px 6px; border-radius: 10px;
  background: var(--blue); color: white; font-size: 12px; line-height: 1.2;
}
.secondary.confirm-receipt { background: #237044; color: white; border-color: #237044; font-weight: 650; }
.secondary.confirm-receipt:hover { background: #195b35; }
.ticket-action { display: inline-flex; align-items: center; }
#bookings-content > .deal-card { margin-top: 16px; }

.shipment-card.new-delivery {
  border: 2px solid var(--link-color);
  background: var(--accent);
}
.new-delivery-label {
  display: inline-block; margin-bottom: 8px; padding: 3px 8px;
  border-radius: 5px; background: var(--blue); color: white; font-weight: 650;
}

/* Gemeinsame Packliste: Referenzen bleiben ohne Aufklappen sichtbar. */
.packing-rows { display: grid; gap: 12px; width: 100%; }
.packing-row:not(.unavailable), .shop-option { cursor: pointer; }
.invoice-position-description { margin-top: 6px; }
.invoice-preview-description { white-space: pre-wrap; overflow-wrap: anywhere; }
.packing-row { display: grid; grid-template-columns: auto minmax(180px, 1fr) auto auto; gap: 20px; align-items: center; padding: 18px; border: 1px solid var(--line); border-radius: 12px; }
.packing-row.selected { background: var(--success-bg); border-color: var(--good); }
.packing-row > input[type=checkbox] { width: 20px; height: 20px; min-height: 0; padding: 0; }
.packing-details, .packing-balance { display: grid; gap: 5px; }
.packing-order { overflow-wrap: anywhere; font-family: monospace; }
.packing-quantity { display: flex; gap: 8px; align-items: end; }
.packing-quantity input { width: 100px; }
.packing-quantity button { min-width: 42px; }
.booking-form:has(.packing-rows) { display: flex; flex-direction: column; align-items: stretch; }
@media (max-width: 760px) {
  .packing-row { grid-template-columns: auto minmax(0, 1fr); gap: 12px; }
  .packing-balance, .packing-quantity { grid-column: 2; }
}

.packing-quantity label { display: grid; gap: 5px; }

/* Gemeinsame Ausrichtung und klar gruppierte Dealwerte. */
.page-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.page-actions > button { margin: 0; }
.deal-card-heading { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 18px; }
.deal-card-heading h3 { margin: 0; font-size: 19px; }
.deal-statuses { display: flex; flex-wrap: wrap; gap: 7px; }
.deal-status, .packing-unavailable { display: inline-flex; width: fit-content; padding: 5px 9px; border-radius: 6px; font-size: 12px; font-weight: 650; line-height: 1.4; background: var(--subtle); color: var(--muted); }
.deal-status.complete { color: var(--good); background: var(--success-bg); }
.deal-status.partial { color: #885900; background: #fff0c5; }
.deal-status.packed { color: var(--link-color); background: var(--accent); }
.deal-status.problem { color: var(--bad); background: var(--error-bg); }
.deal-progress { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; padding: 14px; border-radius: 9px; background: var(--subtle); }
.deal-metric { display: grid; align-content: start; gap: 5px; }
.deal-metric strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.deal-card-details { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; }
.deal-card-details > * + * { border: 0; padding: 0; }
.deal-card .overview-facts { grid-template-columns: 130px minmax(0, 1fr); gap: 8px 14px; }
.deal-financials { display: grid; grid-template-columns: minmax(0, 1fr) minmax(130px, .6fr); gap: 16px 20px; }
.deal-financials > .overview-facts:first-child dd { font-weight: 650; font-size: 17px; }
.deal-financials > .overview-facts:last-child { grid-column: 1 / -1; padding-top: 12px; border-top: 1px solid var(--line); }
.deal-action-buttons { border-top: 1px solid var(--line); padding-top: 14px; }
.booking-form > label { display: grid; gap: 6px; }
.booking-form:has(.packing-rows) > label { flex: 0 0 auto; }
.booking-form:has(.packing-rows) > button { align-self: flex-end; }
#bookings-content > h2 { margin-top: 22px; }
#bookings-content > label { display: grid; gap: 8px; margin-top: 18px; }
.packing-row { background: var(--surface); }
.packing-row.unavailable { background: var(--subtle); border-style: dashed; }
.packing-row.unavailable .packing-quantity { opacity: .5; }
.packing-row input[type=checkbox] { accent-color: var(--good); cursor: pointer; outline: none; box-shadow: none; }
.packing-row input[type=checkbox]:focus-visible { outline: 2px solid var(--good); outline-offset: 4px; }
.packing-row input:disabled, button:disabled { cursor: not-allowed; }
.packing-unavailable { border: 1px solid var(--line); margin-top: 7px; }
.packing-quantity label { flex: 0 1 auto; }
.packing-quantity button { height: 40px; }
.packing-quantity input { height: 40px; }
.receipt-state { margin: 12px 0; font-weight: 650; }
@media (max-width: 1000px) {
  .deal-card-details { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .deal-progress { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .page-header { align-items: flex-start; gap: 16px; }
  .page-actions { width: 100%; }
  .deal-progress { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .deal-financials { grid-template-columns: minmax(0, 1fr); }
  .deal-card .overview-facts { grid-template-columns: 110px minmax(0, 1fr); }
  .deal-financials > .overview-facts:last-child { grid-column: 1; }
  .packing-quantity { flex-wrap: wrap; }
  .booking-form:has(.packing-rows) > button { align-self: stretch; }
}
@media (max-width: 560px) { .page-header { flex-direction: column; } .page-header .subtitle { max-width: none; } .page-actions > button { flex: 1; } }
