:root{font-family:system-ui,-apple-system,sans-serif;color:#182a40;background:#f7f8fb;--line:#dde4ed;--blue:#27527e;--paper:#fff;--muted:#546579}*{box-sizing:border-box}body{margin:0;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}header,nav,main{max-width:1050px;margin:auto;padding:0 22px}header{min-height:68px;display:flex;align-items:center;justify-content:space-between}.brand{display:flex;align-items:center;gap:10px;font-size:1.27rem;font-weight:730}.brand i{width:11px;height:11px;border-radius:50%;background:var(--blue)}nav{display:flex;gap:4px;overflow-x:auto;padding-bottom:12px}nav button{white-space:nowrap;border:0;background:transparent}nav button[aria-current=true]{background:#e4edf7;color:#173a5e}main{padding-top:18px;padding-bottom:44px}h1{font-size:clamp(1.8rem,5vw,2.5rem);letter-spacing:-.04em;margin:0}h2{font-size:1.2rem;margin:0 0 15px}section{margin:22px 0}.top,.controls,.line{display:flex;gap:10px;align-items:center;justify-content:space-between}.controls{justify-content:flex-start;flex-wrap:wrap;margin:15px 0}.panel,.rows{background:var(--paper);border:1px solid var(--line);border-radius:13px;padding:17px}.rows{padding:0;overflow:hidden}.row{display:flex;text-align:left;align-items:center;justify-content:space-between;width:100%;gap:12px;border:0;border-bottom:1px solid var(--line);border-radius:0;background:white;padding:13px 15px}.row:last-child{border:0}.row strong,.row small{display:block;overflow-wrap:anywhere}.row small{margin-top:4px;color:var(--muted);font-size:.875rem}.row .right{text-align:right;flex-shrink:0}.num{font-variant-numeric:tabular-nums}.negative,.error{color:#a8312c}.badge{display:inline-block;border-radius:6px;background:#e8ddef;color:#473357;padding:3px 7px;font-size:.875rem}.chart{display:grid;gap:8px}.bar-row{padding:7px;display:grid;grid-template-columns:3rem 1fr minmax(6rem,auto);align-items:center;gap:7px;text-align:left;border:0}.bar-row[aria-pressed=true]{background:#edf4fc}.track{position:relative;height:13px}.track span{position:absolute;height:100%;top:0}.guido{background:#ebc06c}.nicole{background:#5ea0e9}.legend{display:flex;gap:15px;flex-wrap:wrap;color:var(--muted);margin:.7rem 0;font-size:.9rem}.legend i{display:inline-block;width:10px;height:10px;border-radius:2px;margin-right:5px}button,input,select,textarea{font:inherit}button{border:1px solid var(--line);background:white;border-radius:8px;color:inherit;padding:8px 11px;cursor:pointer;min-height:40px}button.primary{background:var(--blue);border-color:var(--blue);color:white}button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:2px solid #275c9a;outline-offset:2px}button:disabled{opacity:.55;cursor:default}label{display:grid;gap:5px;font-size:.9rem}input,select,textarea{border:1px solid var(--line);border-radius:7px;padding:8px;background:white;color:inherit;width:100%;min-height:40px;font-size:16px}dialog{color:inherit;border:1px solid var(--line);border-radius:14px;width:min(510px,calc(100% - 24px));max-height:87dvh;padding:20px}dialog::backdrop{background:#15253677}#fields{display:grid;gap:10px}footer{display:flex;gap:8px;justify-content:flex-end}p{line-height:1.45;color:var(--muted)}#error{color:#a8312c}#message:not(:empty){position:fixed;bottom:20px;left:50%;translate:-50% 0;background:#182a40;color:white;border-radius:8px;padding:10px 14px;max-width:90%;z-index:4}details{margin-top:12px}summary{cursor:pointer}@media(max-width:500px){header,nav,main{padding-left:13px;padding-right:13px}.panel{padding:12px}.row{padding:11px}.bar-row{font-size:.9rem}.row .right{max-width:40%}}

.finance-controls{display:grid;gap:10px;margin:15px 0}
.finance-actions{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));align-items:stretch;gap:8px}
.finance-actions>select,.finance-actions>button{height:44px;min-width:0;width:100%;margin:0;white-space:nowrap}
@media(max-width:540px){.finance-actions{grid-template-columns:repeat(2,minmax(0,1fr))}}

.report-bookings-heading{margin-bottom:16px}.report-bookings-heading h2{margin-bottom:0}

:root { color-scheme: light dark; }

@media (prefers-color-scheme: dark) {
  :root {
    color: #e8eff8;
    background: #101722;
    --paper: #192433;
    --line: #364559;
    --muted: #b5c3d5;
    --blue: #315d90;
  }
  button, input, select, textarea, dialog, .row { background: var(--paper); }
  nav button { background: transparent; }
  nav button[aria-current=true] { background: #263e5b; color: #e4efff; }
  .bar-row[aria-pressed=true] { background: #233851; }
  .negative, .error, #error { color: #ff9b95; }
  button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline-color: #9bc4ff; }
  #message:not(:empty) { background: #daeaff; color: #14273c; }
  dialog::backdrop { background: #050911b8; }
}

/* Window layout and navigation */
:root {
  --window: #f8f9fb;
  --sidebar: #f0f2f5;
  --selection: #dce8f6;
  --selection-text: #183f66;
  --table-heading: #eff2f6;
}
body {
  background: var(--window);
  display: grid;
  grid-template-columns: minmax(215px, 240px) minmax(0, 1fr);
  min-height: 100dvh;
}
.mobile-header, #menu-close { display: none; }
#desktop-sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--line);
}
.sidebar {
  position: sticky;
  top: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
}
.sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 9px 18px;
}
.brand { font-size: 1.18rem; letter-spacing: -.015em; }
.brand img { width: 30px; height: 30px; object-fit: contain; }
#nav {
  display: grid;
  gap: 4px;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  overflow: visible;
}
#nav button {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  min-height: 38px;
  font-size: .875rem;
  text-align: left;
}
#nav button svg { width: 18px; height: 18px; }
#nav button[aria-current=page] { background: var(--selection); color: var(--selection-text); font-weight: 650; }
#nav button:hover:not([aria-current]) { background: var(--paper); }
.sidebar-foot {
  margin-top: auto;
  padding: 11px 9px 0;
  border-top: 1px solid var(--line);
  display: grid;
  justify-items: start;
  gap: 8px;
  color: var(--muted);
}
#cloud-status { margin: 0; font-size: .875rem; }
#files { min-height: 34px; font-size: .875rem; }
#main {
  display: grid;
  align-content: start;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  max-width: 1230px;
  margin: 0 auto;
  padding: 18px clamp(22px, 3.2vw, 48px) 44px;
}
.page-heading { grid-row: 2; min-width: 0; margin: 10px 0 16px; }
.page-heading h1 { overflow-wrap: anywhere; }
.page-heading button.primary {
  flex-shrink: 0;
  color: inherit;
  background: var(--paper);
  border-color: var(--line);
}
.page-tools {
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 6px;
}
.page-tools[hidden] { display: none; }
.search-box { position: relative; width: min(100%, 335px); }
.search-box input { border-radius: 10px; padding-left: 35px; background: var(--paper); }
.search-icon {
  position: absolute;
  z-index: 1;
  top: 12px;
  left: 12px;
  width: 13px;
  height: 13px;
  border: 1.7px solid var(--muted);
  border-radius: 50%;
  pointer-events: none;
}
.search-icon::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 1.7px;
  background: var(--muted);
  transform: rotate(45deg);
  left: 9px;
  top: 9px;
}
#page-content { grid-row: 3; min-width: 0; }
#page-content > section:first-child { margin-top: 0; }
.production-list {
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.production-table { width: 100%; border-collapse: collapse; text-align: left; }
.production-table td, .production-table th { border-bottom: 1px solid var(--line); padding: 10px 12px; }
.production-table th { background: var(--table-heading); font-size: .875rem; white-space: nowrap; }
.production-table th button, .production-name button {
  min-height: 30px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  text-align: left;
  overflow-wrap: anywhere;
}
.production-table th button::after { content: " ↕"; color: var(--muted); }
.production-table th[aria-sort=ascending] button::after { content: " ↑"; }
.production-table th[aria-sort=descending] button::after { content: " ↓"; }
.production-table tbody tr:last-child td { border-bottom: 0; }
.production-date, .production-total { white-space: nowrap; font-variant-numeric: tabular-nums; }
.production-total { text-align: right; }
.production-name button { width: 100%; font-weight: 650; }
.production-name button:hover { text-decoration: underline; }
.icon-button { font-size: 1.25rem; line-height: 1; min-width: 44px; }
@media (max-width: 720px) {
  body { display: block; }
  #desktop-sidebar { display: none; }
  .mobile-header {
    display: flex;
    justify-content: flex-start;
    gap: 12px;
    min-height: 59px;
    margin: 0;
    padding: 7px 15px;
    border-bottom: 1px solid var(--line);
    background: var(--paper);
  }
  .mobile-header button { border: none; color: var(--selection-text); background: transparent; }
  #menu-dialog {
    position: fixed;
    inset: 0 auto 0 0;
    margin: 0;
    padding: 0;
    width: min(320px, 88vw);
    height: 100dvh;
    max-height: none;
    max-width: none;
    border: 0;
    border-radius: 0;
    background: var(--sidebar);
  }
  #menu-dialog .sidebar {
    position: static;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    min-height: 100%;
  }
  #menu-close { display: inline-block; }
  #nav button, #files { min-height: 44px; }
  #main { padding: 18px 15px 30px; }
  .page-heading { grid-row: 1; margin: 0 0 12px; gap: 6px; }
  .page-heading h1 { font-size: clamp(1.55rem, 6vw, 2rem); }
  .page-heading button { min-height: 44px; font-size: .9rem; }
  .page-tools { grid-row: 2; border: none; margin: 0 0 12px; padding: 0; }
  .search-box { width: 100%; }
  .search-box input { min-height: 44px; }
  .search-icon { top: 14px; }
  .production-list { background: transparent; border: 0; overflow: visible; }
  .production-table, .production-table tbody { display: block; }
  .production-table thead { display: none; }
  .production-table tbody { display: grid; gap: 10px; }
  .production-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, auto);
    gap: 4px 12px;
    align-items: center;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
  }
  .production-table td { padding: 0; border: 0; }
  .production-name button { min-height: 36px; }
  .production-status { text-align: right; overflow-wrap: anywhere; }
  .production-date { order: 2; text-align: right; color: var(--muted); }
  .production-theatre { order: 1; overflow-wrap: anywhere; color: var(--muted); }
  td.production-total { order: 3; grid-column: 1 / -1; }
  .production-empty td { grid-column: 1 / -1; }
}
@media (prefers-color-scheme: dark) {
  :root {
    --window: #101722;
    --sidebar: #151e2c;
    --selection: #263e5b;
    --selection-text: #e4efff;
    --table-heading: #223145;
  }
}

/* ===== Gemeinsam: neue Bausteine (Kopf, Jahre, Buchungsblatt) ===== */
.title-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; }
.page-heading { display: block; }
.add svg { display: none; width: 20px; height: 20px; }
.sync-line { display: none; }
.mobile-only, .tabbar, #finance-more, .page-heading .mobile-add { display: none; }
.pills { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pill { border: 0; border-radius: 17px; min-height: 34px; padding: 0 14px; font-weight: 600; white-space: nowrap; background: #e4e7ee; }
.pill[aria-pressed=true] { background: var(--blue); color: #fff; }
.finance-controls .pills { margin-bottom: 2px; }
.month { display: flex; justify-content: space-between; align-items: baseline; margin: 18px 4px 7px; }
.month h3 { margin: 0; font-size: 15px; }
.month span { font-size: 13px; color: var(--muted); }
.segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; background: #e4e7ee; border-radius: 9px; padding: 2px; }
.segmented label, .chips label { position: relative; display: block; }
.segmented input, .chips input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.segmented span { display: flex; align-items: center; justify-content: center; min-height: 36px; border-radius: 7px; font-weight: 600; color: var(--muted); text-align: center; font-size: .9rem; }
.segmented input:checked + span { background: var(--paper); color: inherit; box-shadow: 0 1px 3px rgba(21,38,58,.15); }
.segmented input:focus-visible + span, .chips input:focus-visible + span { outline: 2px solid #275c9a; outline-offset: 1px; }
.amount input { font-size: 30px; font-weight: 650; font-variant-numeric: tabular-nums; }
.group { display: grid; gap: 10px; }
.chips { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips legend { font-size: .9rem; margin-bottom: 6px; padding: 0; }
.chips span { display: flex; align-items: center; min-height: 36px; padding: 0 13px; border: 1px solid var(--line); border-radius: 17px; font-weight: 600; background: var(--paper); }
.chips input:checked + span { background: var(--chip, #dce8f6); border-color: #15263a55; color: #15263a; }
@media (prefers-color-scheme: dark) {
  .pill, .segmented { background: #243246; }
  .chips input:checked + span { border-color: #ffffff55; }
}

/* Produktionsseite */
.detail-bar { display: flex; justify-content: space-between; margin-bottom: 6px; }
.detail-bar button { border: 0; background: transparent; color: var(--blue); padding: 6px 0; font-size: 1rem; }
.facts { background: var(--paper); border: 1px solid var(--line); border-radius: 13px; overflow: hidden; margin-bottom: 16px; }
.fact { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 11px 15px; border-bottom: 1px solid var(--line); }
.fact:last-child { border-bottom: 0; }
.fact span { color: var(--muted); }
.fact strong { font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.detail-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 8px; }
.detail-tiles .tile { background: var(--paper); border: 1px solid var(--line); border-radius: 13px; padding: 12px 14px; display: grid; gap: 4px; min-width: 0; }
.detail-tiles .tile-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.detail-tiles .tile-label i { width: 8px; height: 8px; border-radius: 2px; }
.detail-tiles .tile strong { font-size: 1.2rem; }
.detail-tiles .tile small { font-size: 12px; color: var(--muted); }
i.sum { background: var(--blue); } i.taxdot { background: #9aa6b4; }
h2 .count { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 6px; }

/* ===== iPhone ===== */
@media (max-width: 720px) {
  :root { --ios-bg: #f2f3f7; --ios-fill: #e4e7ee; --sep: #e6e9ef; }
  body { background: var(--ios-bg); padding-top: 0; }
  .mobile-header { display: none; }
  .mobile-only { display: block; }
  .desktop-only { display: none; }
  #main { padding: calc(env(safe-area-inset-top) + 44px) 16px calc(100px + env(safe-area-inset-bottom)); }
  /* Unter der Statusleiste weichzeichnet iOS den Rand; Inhalt erst darunter beginnen (wie die Navigationsleiste nativer Apps). */

  /* Kopf: grosser Titel, runder Plus-Knopf, Sync-Zeile */
  .page-heading { margin: 0 0 14px; }
  .page-heading h1 { font-size: 34px; line-height: 41px; letter-spacing: -.4px; font-weight: 700; }
  .page-heading button.add { width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 22px; border: 0; background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center; }
  .add svg { display: block; }
  .page-heading .mobile-add { display: flex; }
  .report-bookings-heading button { display: none; }
  .add span { display: none; }
  .sync-line { display: flex; align-items: center; gap: 6px; margin: 4px 0 0; font-size: 13px; line-height: 1.3; color: var(--muted); }
  .sync-line i { flex: none; width: 8px; height: 8px; border-radius: 4px; background: #9aa6b4; }
  .sync-line i.ok { background: #2f8a55; }
  .sync-line i.waiting { background: #e0a93f; }

  /* Suche und Menü «…» */
  .page-tools { grid-row: 2; gap: 8px; margin: 0 0 12px; }
  .search-box input { min-height: 38px; height: 38px; border: 0; border-radius: 10px; background: var(--ios-fill); }
  .search-icon { top: 12px; }
  #finance-more { display: flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 38px; min-height: 38px; border: 0; border-radius: 10px; background: var(--ios-fill); color: var(--blue); padding: 0; }
  #finance-more svg { width: 20px; height: 20px; }

  /* Listen als Gruppen */
  .rows, .panel { border: 0; border-radius: 14px; }
  .row { min-height: 60px; padding: 11px 16px; border-bottom: 1px solid var(--sep); }
  .row strong { font-weight: 600; }
  .row small { font-size: 13px; margin-top: 2px; }
  .row .right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
  .row .right .num { font-weight: 600; }
  .row .right:empty::after { content: ""; width: 8px; height: 8px; border-right: 2px solid #9aa6b4; border-bottom: 2px solid #9aa6b4; transform: rotate(-45deg); margin-right: 3px; }
  .badge { font-size: 12px; font-weight: 600; padding: 3px 7px; color: #15263a; }
  section h2, .panel h2 { font-size: 20px; font-weight: 650; margin: 0 0 8px 4px; }
  .panel h2 { margin-left: 0; }

  /* Report */
  .mobile-only .pills { margin-bottom: 14px; }
  .tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; }
  .tile { background: var(--paper); border-radius: 14px; padding: 13px 14px; display: grid; gap: 4px; min-width: 0; }
  .tile-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
  .tile-label i { flex: none; width: 8px; height: 8px; border-radius: 2px; }
  .tile strong { font-size: 21px; font-weight: 650; overflow-wrap: anywhere; }
  .tile small { font-size: 12px; color: var(--muted); }
  i.sum { background: var(--blue); } i.taxdot { background: #9aa6b4; }
  .chart { gap: 4px; }
  .bar-row { min-height: 40px; grid-template-columns: 2.6rem 1fr auto; font-size: 13px; border-radius: 8px; }
  .legend { font-size: 12px; }

  /* Produktionen als Gruppe statt Karten */
  .production-table tbody { gap: 0; background: var(--paper); border-radius: 14px; overflow: hidden; }
  .production-table tbody tr { border: 0; border-radius: 0; border-bottom: 1px solid var(--sep); padding: 11px 16px; gap: 2px 12px; }
  .production-table tbody tr:last-child { border-bottom: 0; }
  .production-name button { font-size: 16px; font-weight: 600; min-height: 28px; color: inherit; }
  .production-theatre, .production-date { font-size: 13px; }

  /* Finanzen */
  .finance-controls { margin: 0 0 4px; }
  .finance-controls .pills { margin: 0 -16px; padding: 0 16px; }
  .finance-actions { display: none; }
  .finance-actions.open { display: grid; grid-template-columns: 1fr 1fr; background: var(--paper); border-radius: 14px; padding: 10px; box-shadow: 0 8px 28px rgba(21,38,58,.18); }
  .finance-actions.open > * { height: 44px; }

  /* Produktionsseite */
  .detail-bar button { font-size: 17px; min-height: 44px; }
  .facts { border: 0; border-radius: 14px; }
  .fact { border-bottom-color: var(--sep); min-height: 48px; padding: 10px 16px; }
  .detail-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 22px; }
  .detail-tiles .tile { border: 0; border-radius: 14px; }
  .detail-tiles .tile strong { font-size: 21px; }

  /* Mehr */
  .menu-title { font-size: 13px; font-weight: 400; text-transform: uppercase; color: var(--muted); margin: 0 4px 7px 16px; }
  .menu-group { background: var(--paper); border-radius: 14px; overflow: hidden; margin-bottom: 22px; }
  .menu-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px 16px; border: 0; border-bottom: 1px solid var(--sep); border-radius: 0; background: var(--paper); text-align: left; }
  .menu-row:last-child { border-bottom: 0; }
  .menu-icon { flex: none; width: 29px; height: 29px; border-radius: 7px; display: flex; align-items: center; justify-content: center; }
  .menu-icon svg { width: 17px; height: 17px; }
  .menu-label { flex: 1; font-size: 16px; }
  .menu-value { font-size: 15px; color: var(--muted); }

  /* Tab-Leiste */
  .tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 3; max-width: none; margin: 0;
    padding: 6px max(4px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
    background: rgba(249,250,252,.94); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border-top: 1px solid #dfe3ea; overflow: visible; }
  .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 48px; padding: 0; border: 0; border-radius: 0; background: transparent; color: #5f6c7c; }
  .tabbar button svg { width: 25px; height: 25px; }
  .tabbar button span { font-size: 10px; font-weight: 600; }
  .tabbar button[aria-current=page] { color: var(--blue); }

  /* Meldung über der Tab-Leiste */
  #message:not(:empty) { bottom: calc(96px + env(safe-area-inset-bottom)); border-radius: 20px; padding: 10px 16px; font-size: 14px; text-align: center; }

  /* Dialog als Blatt von unten: Abbrechen · Titel · Sichern */
  dialog#dialog { margin: auto 0 0; width: 100%; max-width: none; max-height: calc(100dvh - env(safe-area-inset-top) - 12px); height: calc(100dvh - env(safe-area-inset-top) - 12px);
    border: 0; border-radius: 14px 14px 0 0; padding: 0; background: var(--ios-bg); }
  #form { display: grid; grid-template-columns: 1fr auto 1fr; grid-template-rows: auto auto 1fr; height: 100%; }
  #form footer { display: contents; }
  #close, #save { grid-row: 1; min-height: 52px; border: 0; background: transparent; color: var(--blue); font-size: 17px; padding: 0 16px; }
  #close { grid-column: 1; justify-self: start; }
  #save { grid-column: 3; justify-self: end; font-weight: 650; }
  #dialog-title { grid-row: 1; grid-column: 2; align-self: center; margin: 0; font-size: 17px; font-weight: 650; text-align: center; }
  #error { grid-row: 2; grid-column: 1 / -1; margin: 0 16px; }
  #error:empty { display: none; }
  #fields { grid-row: 3; grid-column: 1 / -1; overflow-y: auto; align-content: start; gap: 14px; padding: 6px 16px calc(24px + env(safe-area-inset-bottom)); }
  #fields > label, .amount { background: var(--paper); border-radius: 14px; padding: 10px 16px; font-size: 13px; color: var(--muted); }
  #fields > label input, #fields > label select, #fields > label textarea { border: 0; padding: 4px 0; min-height: 34px; color: var(--text, inherit); background: transparent; }
  #fields > label textarea { resize: none; }
  .amount input { font-size: 34px; padding: 2px 0; }
  .group { gap: 0; grid-template-columns: minmax(0, 1fr); background: var(--paper); border-radius: 14px; overflow: hidden; }
  .group label { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 0 16px; border-bottom: 1px solid var(--sep); font-size: 16px; }
  .group label:last-child { border-bottom: 0; }
  .group input, .group select { width: auto; flex: 1; min-width: 0; border: 0; text-align: right; color: var(--blue); background: transparent; padding: 0; }
  .group select { text-align-last: right; }
  .chips legend { font-size: 13px; color: var(--muted); margin: 0 0 8px 16px; }
  #fields > button[data-action=remove] { color: #a8312c; border: 0; border-radius: 14px; min-height: 48px; background: var(--paper); }
  #fields > p, #fields > .controls { margin: 0; }
}
@media (max-width: 720px) and (prefers-color-scheme: dark) {
  :root { --ios-bg: #0b111a; --ios-fill: #1d2837; --sep: #2a3647; }
  .tabbar { background: rgba(16,23,34,.92); border-top-color: #2a3647; }
  .tabbar button { color: #93a2b5; }
  .tabbar button[aria-current=page] { color: #8fbaf0; }
  #close, #save, .group input, .group select, #finance-more { color: #8fbaf0; }
  .page-heading button.add { background: #315d90; }
  .badge { color: #15263a; }
}
