:root {
  --bg: #f3f2ef;
  --sf: #fff;
  --tx: #202b3a;
  --mu: #77808c;
  --ac: #202b3a;
  --gold: #c6a76b;
  --gold-soft: #f4efe5;
  --ln: #e6e3dd;
  --wa: #b77932;
  --rd: #b94b4b;
  --ok: #43816d;
  --sd: 0 8px 24px rgba(27, 38, 52, 0.055);
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
}
body {
  background: var(--bg);
  color: var(--tx);
  font:
    15px/1.5 Inter,
    Manrope,
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  padding-bottom: 150px;
  letter-spacing: -0.01em;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
}
button:active {
  transform: scale(0.985);
}
header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 14px;
  max-width: 720px;
  margin: 0 auto;
}
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #263448, #111a27);
  color: #d8bd88;
  border: 1px solid rgba(198, 167, 107, 0.55);
  border-radius: 13px;
  font:
    600 22px/1 Georgia,
    serif;
  box-shadow: 0 5px 14px rgba(20, 31, 45, 0.16);
}
.brand-logo {
  display: block;
  flex: none;
  background: none;
  border: 0;
  border-radius: 10px;
  object-fit: contain;
}
.brand-copy {
  flex: 1;
  min-width: 0;
}
h1 {
  font-size: 23px;
  line-height: 1.1;
  margin: 0;
  flex: 1;
  font-weight: 700;
  letter-spacing: -0.045em;
}
h1 span {
  font-weight: 400;
  color: #8b754e;
}
.brand-copy small {
  display: block;
  margin-top: 4px;
  font-size: 9px;
  letter-spacing: 0.19em;
  color: var(--mu);
  font-weight: 650;
}
/* Sync-Ampel: grau = nicht verbunden, orange (pulsierend) = beschäftigt, grün = synchron, rot (mit Ring) = Fehler */
#st {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
#st:hover {
  background: var(--gold-soft);
}
#st:before {
  content: "";
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #b9c2cf;
  box-shadow: 0 0 0 2px var(--sf);
}
#st.ok:before {
  background: var(--ok);
}
#st.busy:before {
  background: var(--wa);
  animation: st-pulse 1.2s ease-in-out infinite;
}
#st.err:before {
  background: var(--rd);
  box-shadow:
    0 0 0 2px var(--sf),
    0 0 0 4px rgba(185, 75, 75, 0.45);
}
@keyframes st-pulse {
  50% {
    opacity: 0.35;
    transform: scale(0.8);
  }
}
@media (prefers-reduced-motion: reduce) {
  #st.busy:before {
    animation: none;
  }
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.ib {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 19px;
  padding: 8px;
  color: #697382;
}
.ib:hover {
  background: #eeece7;
  border-color: var(--ln);
}
main {
  padding: 0 18px;
  max-width: 720px;
  margin: 0 auto;
}
h2 {
  font-size: 16px;
  margin: 27px 2px 11px;
  font-weight: 700;
  letter-spacing: -0.025em;
}
.mu {
  color: var(--mu);
}
.hero {
  background: linear-gradient(135deg, #263448 0%, #172231 100%);
  color: #fff;
  border-radius: 22px;
  padding: 23px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(25, 38, 54, 0.16);
}
.hero:after {
  content: "";
  position: absolute;
  width: 190px;
  height: 190px;
  border: 1px solid rgba(198, 167, 107, 0.22);
  border-radius: 50%;
  right: -78px;
  top: -92px;
  box-shadow:
    0 0 0 22px rgba(198, 167, 107, 0.035),
    0 0 0 45px rgba(198, 167, 107, 0.025);
}
.hero small {
  opacity: 0.76;
  font-size: 12px;
  letter-spacing: 0.04em;
}
.big {
  font-size: 37px;
  font-weight: 650;
  margin: 5px 0 1px;
  letter-spacing: -0.055em;
}
.hs {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 17px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 12px;
  color: #e7e9ed;
}
.hs b {
  color: #e0c58f;
}
.card {
  background: var(--sf);
  border: 1px solid var(--ln);
  border-radius: 17px;
  padding: 17px;
  margin: 12px 0;
  box-shadow: var(--sd);
}
.note {
  background: #faf7f0;
  border-color: #e8dcc5;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--sf);
  border: 1px solid var(--ln);
  border-radius: 15px;
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: 0 3px 12px rgba(27, 38, 52, 0.035);
}
.row:hover,
.tile:hover {
  border-color: #cdb98f;
  box-shadow: 0 7px 18px rgba(27, 38, 52, 0.075);
}
.ic {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 19px;
  background: var(--gold-soft);
  filter: grayscale(0.35);
}
.m {
  flex: 1;
  min-width: 0;
}
.m b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 650;
}
.m small {
  color: var(--mu);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  margin-top: 2px;
}
.m small.w {
  color: var(--wa);
  font-weight: 650;
}
.m small.r {
  color: var(--rd);
  font-weight: 650;
}
.pr {
  text-align: right;
  font-weight: 700;
  white-space: nowrap;
  font-size: 13px;
}
.pr small {
  display: block;
  font-weight: 400;
  color: var(--mu);
  font-size: 11px;
}
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
}
.tile {
  background: var(--sf);
  border: 1px solid var(--ln);
  border-radius: 16px;
  padding: 15px;
  text-align: left;
  box-shadow: 0 3px 12px rgba(27, 38, 52, 0.035);
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 106px;
}
.tile .ic {
  margin-bottom: 7px;
}
.tile b {
  font-size: 13px;
  font-weight: 650;
}
.tile small {
  color: var(--mu);
  font-size: 11px;
  line-height: 1.5;
}
input[type="search"],
.f input,
.f select,
.f textarea,
#so {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid #dedbd4;
  border-radius: 11px;
  background: var(--sf);
  outline: none;
  transition:
    border-color 0.18s,
    box-shadow 0.18s;
}
input[type="search"] {
  margin-top: 5px;
}
#so {
  width: auto;
  padding: 8px 11px;
  font-size: 12px;
}
#chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0 8px;
  scrollbar-width: none;
}
#chips::-webkit-scrollbar {
  display: none;
}
.chip {
  flex: none;
  border: 1px solid #dedbd4;
  background: var(--sf);
  border-radius: 22px;
  padding: 8px 14px;
  font-size: 12px;
  color: #5d6672;
}
.chip.on {
  background: #202b3a;
  color: #f1dfb8;
  border-color: #202b3a;
}
.btn {
  background: #202b3a;
  color: #fff;
  border: 1px solid #202b3a;
  border-radius: 11px;
  padding: 12px 17px;
  font-weight: 650;
  font-size: 13px;
  box-shadow: 0 4px 10px rgba(32, 43, 58, 0.12);
}
.btn:hover {
  background: #2e4057;
}
.btn.s {
  background: #fff;
  color: #283548;
  border: 1px solid #c9c4b9;
  box-shadow: none;
}
.btn.s:hover {
  background: #f5f2ec;
  border-color: var(--gold);
}
.btn.x {
  background: none;
  color: var(--rd);
  border-color: transparent;
  box-shadow: none;
}
.btn.w {
  width: 100%;
}
.add {
  width: 100%;
  background: #faf8f4;
  border: 1px dashed #cfc4ae;
  border-radius: 11px;
  padding: 12px;
  color: #8c744a;
  font-weight: 650;
  font-size: 13px;
  margin-bottom: 6px;
}

/* Bottom navigation: 5 equal slots (Übersicht, Einträge, Neu, Kalender, Mehr) */
nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: stretch;
  padding: 7px 0 calc(7px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--ln);
}
nav button {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 0 5px;
  background: none;
  border: 0;
  color: #8b929b;
  font-size: 11px;
  font-weight: 550;
  letter-spacing: 0;
  white-space: nowrap;
}
nav button span {
  display: grid;
  place-items: center;
  height: 24px;
  color: currentColor;
  font-family: system-ui, sans-serif;
  font-size: 20px;
  line-height: 1.15;
}
nav button.on {
  color: #263448;
  font-weight: 750;
}
nav button.on:after {
  content: "";
  width: 17px;
  height: 2px;
  border-radius: 2px;
  background: var(--gold);
  margin-top: 1px;
}
nav .ui-icon {
  width: 20px;
  height: 20px;
  color: currentColor;
}
nav button[data-t="calendar"] .ui-icon {
  width: 21px;
  height: 21px;
}
nav button.nav-add {
  color: #8b754e;
  font-weight: 750;
  gap: 2px;
}
nav button.nav-add span {
  width: 44px;
  height: 44px;
  margin: 0 auto;
  border-radius: 14px;
  background: #202b3a;
  color: #e2c78f;
  font-size: 23px;
  box-shadow: 0 5px 13px rgba(32, 43, 58, 0.2);
}
nav button.nav-add .ui-icon {
  width: 22px;
  height: 22px;
  color: #e4c991;
  stroke-width: 1.9;
}
nav button.nav-add:after {
  display: none;
}
@media (max-width: 520px) {
  nav button span {
    font-size: 18px;
  }
}
.ov {
  position: fixed;
  inset: 0;
  background: rgba(13, 22, 33, 0.56);
  backdrop-filter: blur(3px);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 5;
}
.ov.on {
  display: flex;
}
.sh {
  background: #f7f6f3;
  width: 100%;
  max-width: 720px;
  max-height: 94vh;
  overflow: auto;
  border-radius: 23px 23px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.12);
}
.sh h3 {
  margin: 0 0 7px;
  font-size: 20px;
  letter-spacing: -0.035em;
}
.sh h4 {
  margin: 22px 0 9px;
  font-size: 11px;
  color: #8b754e;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.f {
  display: block;
  margin-bottom: 13px;
}
.f span {
  display: block;
  font-size: 11px;
  color: #687382;
  margin-bottom: 5px;
  font-weight: 600;
}
.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.doc {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 12px;
  background: var(--sf);
  border: 1px solid var(--ln);
  border-radius: 11px;
  margin-top: 8px;
}
.doc .doc-link {
  flex: 1;
  min-width: 0;
  color: #34465c;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  background: none;
  border: 0;
  padding: 0;
}
.doc .doc-link:hover {
  text-decoration: underline;
}
.bar {
  display: flex;
  gap: 9px;
  margin-top: 20px;
}
.bar .btn:first-child {
  flex: 1;
}
.leg {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  font-size: 12px;
}
.leg i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--c);
}
.leg b {
  margin-left: auto;
}
.bw {
  height: 8px;
  background: #eeece7;
  border-radius: 5px;
  margin-top: 6px;
}
.bw i {
  display: block;
  height: 100%;
  border-radius: 5px;
  background: var(--gold);
}
.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.facts div {
  background: var(--sf);
  border: 1px solid var(--ln);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 3px 12px rgba(27, 38, 52, 0.035);
}
.facts b {
  display: block;
  font-size: 21px;
  letter-spacing: -0.04em;
}
.facts small {
  color: var(--mu);
  font-size: 11px;
}
.hide {
  display: none !important;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid #a8863f;
  outline-offset: 2px;
}
.doc-preview {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(10, 20, 30, 0.82);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
.doc-preview.on {
  display: flex;
}
.preview-panel {
  width: min(100%, 1000px);
  height: min(92dvh, 900px);
  background: var(--bg);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.preview-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--sf);
  border-bottom: 1px solid var(--ln);
}
.preview-name {
  font-weight: 700;
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
}
.preview-body {
  flex: 1;
  min-height: 0;
  background: #e8edf2;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}
.preview-body iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.preview-body img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.preview-msg {
  padding: 28px;
  text-align: center;
  max-width: 460px;
}
.preview-actions {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  background: var(--sf);
  border-top: 1px solid var(--ln);
}
.preview-actions .btn {
  flex: 1;
}
@media (min-width: 700px) {
  main {
    padding: 0 24px;
  }
  header {
    padding: 22px 24px 17px;
  }
  .hero {
    padding: 28px;
  }
  .grid {
    gap: 13px;
  }
}
@media (max-width: 520px) {
  .doc-preview {
    padding: 0;
  }
  .preview-panel {
    height: 100dvh;
    width: 100%;
    border-radius: 0;
  }
  .preview-head {
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
  }
  .preview-name {
    font-size: 14px;
  }
  header {
    padding: 15px 17px 12px;
    gap: 8px;
  }
  .brand-copy h1 {
    font-size: 21px;
  }
  .brand-copy small {
    font-size: 8px;
    letter-spacing: 0.14em;
  }
  main {
    padding: 0 14px;
  }
  .hero {
    padding: 20px;
  }
  .big {
    font-size: 34px;
  }
}

/* Phase 1 / usability refinements */
.ic {
  background: #f0efec !important;
  color: #354253 !important;
  filter: none !important;
  font-family: system-ui, sans-serif;
  font-weight: 600;
  font-size: 20px;
}
.row .ic {
  border: 1px solid #e6e3dd;
}
.f input,
.f select,
.f textarea {
  min-height: 47px;
  font-size: 15px;
  padding: 12px 13px;
  background: #fff;
}
.f textarea {
  min-height: 88px;
  resize: vertical;
}
.f span {
  font-size: 12px;
  margin-bottom: 6px;
}
.sh h4 {
  padding-bottom: 7px;
  border-bottom: 1px solid #e8e3d9;
}
@media (max-width: 520px) {
  .sh {
    padding-left: 16px;
    padding-right: 16px;
  }
  .two {
    gap: 8px;
  }
}

/* Modern monochrome icon system */
.ui-icon {
  width: 21px;
  height: 21px;
  display: block;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ic .ui-icon {
  width: 22px;
  height: 22px;
}
.row .ic {
  background: #f1f0ed !important;
  color: #344256 !important;
  border: 1px solid #e8e5de;
}
.tile .ic {
  background: #f1f0ed !important;
  color: #344256 !important;
}

#docCat {
  font: inherit;
  color: #344256;
}
.doc-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}
.doc-actions .ib {
  font-size: 15px;
  padding: 6px;
}
.doc-meta {
  font-size: 11px;
  color: var(--mu);
  display: block;
  margin-top: 2px;
}

/* Phase 5 & 6 – Einstellungen und Familienkalender */
.settings-section {
  background: #fff;
  border: 1px solid var(--ln);
  border-radius: 16px;
  padding: 15px;
  margin: 12px 0;
  box-shadow: var(--sd);
}
.settings-section h3 {
  margin: 0 0 10px;
  font-size: 15px;
}
.settings-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #efede8;
}
.settings-item:last-child {
  border-bottom: 0;
}
.settings-item span {
  flex: 1;
  min-width: 0;
  font-size: 13px;
}
.settings-item button {
  padding: 5px 8px;
  font-size: 12px;
}
.settings-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.settings-tools .btn {
  font-size: 12px;
  padding: 9px 12px;
}
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0;
}
.cal-month {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.cal-weekday {
  text-align: center;
  color: var(--mu);
  font-size: 11px;
  padding: 7px 0;
}
.cal-day {
  min-height: 48px;
  border: 1px solid transparent;
  background: #fff;
  border-radius: 10px;
  padding: 5px 2px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.cal-day.muted {
  opacity: 0.38;
}
.cal-day.today {
  border-color: var(--gold);
}
.cal-day.selected {
  background: #202b3a;
  color: #fff;
}
.cal-day .dots {
  display: flex;
  gap: 3px;
  min-height: 5px;
}
.cal-day .dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
}
.cal-day.selected .dots i {
  background: #e5c98f;
}
.cal-day .daynum {
  font-size: 12px;
  font-weight: 600;
}
.cal-agenda {
  margin-top: 16px;
}
.event-row {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--ln);
  border-radius: 13px;
  margin: 8px 0;
}
.event-datebox {
  width: 43px;
  flex: none;
  text-align: center;
  background: #f1f0ed;
  border-radius: 10px;
  padding: 6px 3px;
  color: #344256;
}
.event-datebox b {
  display: block;
  font-size: 17px;
  line-height: 1.1;
}
.event-datebox small {
  font-size: 10px;
  text-transform: uppercase;
}
.event-row .m small {
  white-space: normal;
}
.event-done {
  opacity: 0.55;
}
.cal-toolbar {
  display: flex;
  gap: 7px;
  align-items: center;
}
.cal-toolbar .btn {
  padding: 8px 11px;
}
.settings-select {
  width: 100%;
  padding: 11px;
  border: 1px solid var(--ln);
  border-radius: 10px;
  background: #fff;
  margin: 5px 0 10px;
}
.settings-note {
  font-size: 11px;
  color: var(--mu);
  line-height: 1.45;
}
@media (max-width: 520px) {
  .cal-day {
    min-height: 43px;
  }
}

/* NAR Home refinement: settings accordions, dialogs and modal scroll isolation */
body.modal-lock {
  overflow: hidden !important;
  overscroll-behavior: none;
}
body.modal-lock main,
body.modal-lock header,
body.modal-lock nav {
  overflow: hidden;
  touch-action: none;
}
.ov,
.doc-preview {
  overscroll-behavior: contain;
}
.ov.on,
.doc-preview.on {
  touch-action: pan-y;
}
.ov .sh {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.settings-section {
  padding: 0;
  overflow: hidden;
}
.settings-section > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 17px 16px;
  cursor: pointer;
  user-select: none;
}
.settings-section > summary::-webkit-details-marker {
  display: none;
}
.settings-section > summary:after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 1.7px solid #7c8490;
  border-bottom: 1.7px solid #7c8490;
  transform: rotate(45deg);
  margin-left: auto;
  margin-top: -4px;
  transition: transform 0.2s;
}
.settings-section[open] > summary:after {
  transform: rotate(225deg);
  margin-top: 4px;
}
.settings-section > summary .set-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--gold-soft);
  display: grid;
  place-items: center;
  color: #675638;
  flex: none;
}
.settings-section > summary .set-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--tx);
}
.settings-section > summary .set-sub {
  font-size: 11px;
  color: var(--mu);
  margin-top: 3px;
}
.settings-section .settings-content {
  padding: 0 15px 15px;
  border-top: 1px solid #efede8;
}
.settings-section h3 {
  display: none;
}
.settings-item {
  padding: 11px 0;
}
.settings-item .btn {
  border-radius: 10px;
}
#settingsListItems {
  margin-top: 8px;
}
.settings-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(20, 28, 39, 0.48);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  opacity: 0;
  transition: opacity 0.18s;
}
.settings-dialog-backdrop.on {
  opacity: 1;
}
.settings-dialog {
  width: min(100%, 440px);
  max-height: min(82dvh, 720px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 22px;
  box-shadow: 0 24px 80px rgba(10, 18, 30, 0.25);
  overflow: hidden;
  overscroll-behavior: contain;
}
.settings-dialog-head {
  padding: 20px 21px 13px;
  flex: none;
}
.settings-dialog-kicker {
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: #9a8051;
  font-weight: 700;
}
.settings-dialog-head h3 {
  font-size: 19px;
  margin: 7px 0 0;
  color: #202b3a;
}
.settings-dialog-body {
  padding: 4px 21px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.settings-dialog-body p {
  font-size: 13px;
  color: #697381;
  line-height: 1.55;
}
.settings-dialog-body label {
  display: block;
  font-size: 12px;
  font-weight: 650;
  color: #465264;
  margin: 12px 0 6px;
}
.settings-dialog-body input,
.settings-dialog-body textarea {
  width: 100%;
  border: 1px solid #dedbd4;
  border-radius: 12px;
  padding: 13px 14px;
  font: inherit;
  font-size: 14px;
  background: #faf9f7;
  color: #202b3a;
  outline: none;
}
.settings-dialog-body input:focus,
.settings-dialog-body textarea:focus {
  border-color: #c6a76b;
  box-shadow: 0 0 0 3px rgba(198, 167, 107, 0.15);
}
.settings-dialog-foot {
  display: flex;
  gap: 9px;
  padding: 14px 21px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #efede8;
  flex: none;
}
.settings-dialog-foot button {
  flex: 1;
  min-height: 44px;
  border-radius: 12px;
}
.settings-dialog-foot .dialog-primary {
  background: #202b3a;
  color: #fff;
  border: 0;
}
.settings-dialog-foot .dialog-secondary {
  background: #f1f0ed;
  color: #344256;
  border: 0;
}
.settings-dialog-foot .dialog-danger {
  background: #a94747;
  color: #fff;
  border: 0;
}
.settings-dialog.is-danger .settings-dialog-kicker {
  color: #ad5151;
}
@media (max-width: 520px) {
  .settings-dialog-backdrop {
    align-items: flex-end;
    padding: 10px;
  }
  .settings-dialog {
    width: 100%;
    max-height: 86dvh;
    border-radius: 22px 22px 16px 16px;
  }
  .settings-dialog-head {
    padding-top: 22px;
  }
}

/* Responsive dashboard calendar header and compact month grid */
.mini-calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}
.mini-calendar-head h2 {
  margin: 0;
  min-width: 0;
  flex: 1 1 150px;
  line-height: 1.25;
}
.mini-calendar-head .btn {
  flex: 0 0 auto;
  max-width: 100%;
  white-space: nowrap;
}
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.cal-head h2 {
  margin: 0;
  min-width: 0;
  flex: 1 1 150px;
}
.cal-head .cal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
@media (max-width: 520px) {
  .mini-calendar-head {
    align-items: flex-start;
  }
  .mini-calendar-head .btn {
    font-size: 12px;
    padding: 10px 12px;
  }
  .cal-head {
    align-items: center;
  }
  .cal-head h2 {
    font-size: 20px;
  }
  .cal-head .cal-actions {
    margin-left: auto;
  }
}

.mini-calendar-head {
  padding: 0 2px;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}
.mini-calendar-head > div {
  min-width: 0;
}
.mini-calendar-head h2 {
  font-size: 19px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.mini-calendar-head .btn {
  font-size: 12px;
  padding: 10px 12px;
  min-height: 42px;
}
@media (max-width: 370px) {
  .mini-calendar-head {
    grid-template-columns: 1fr;
  }
  .mini-calendar-head .btn {
    justify-self: start;
  }
}

.subcategory-editor {
  margin-top: 20px;
}
.subcategory-editor-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #344256;
  margin-bottom: 9px;
}
.subcategory-editor-head span {
  font-size: 11px;
  color: #8b929b;
  font-weight: 500;
}
.subcategory-fields {
  display: grid;
  gap: 8px;
}
.subcategory-field {
  display: flex;
  gap: 8px;
  align-items: center;
}
.subcategory-field input {
  flex: 1;
  min-width: 0;
}
.subcategory-remove {
  width: 42px;
  height: 42px;
  flex: none;
  border: 1px solid #eadada;
  background: #fbf5f4;
  color: #a94747;
  border-radius: 12px;
  font-size: 22px;
  line-height: 1;
}
.subcategory-add {
  width: 100%;
  margin-top: 10px;
  min-height: 42px;
  border: 1px dashed #cbb98f;
  background: #faf8f3;
  color: #766342;
  border-radius: 12px;
  font-weight: 650;
}

/* Update 10: Bugfixes Einstellungen, Kalender, Navigation */
.settings-section > summary > span:not(.set-icon) {
  display: block;
  min-width: 0;
  flex: 1;
}
.settings-section > summary .set-title {
  display: block;
  font-size: 15px;
  line-height: 1.25;
}
.settings-section > summary .set-sub {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.4;
}
.settings-section > summary {
  gap: 14px;
}
.cal-card {
  background: #fff;
  border: 1px solid var(--ln);
  border-radius: 16px;
  padding: 14px;
  margin: 12px 0;
  box-shadow: var(--sd);
}
.cal-card .mini-calendar-head {
  padding: 0;
}
.event-datebox {
  width: 54px;
  padding: 8px 3px;
}
.event-datebox b {
  font-size: 15px;
  line-height: 1.2;
}
.event-badge {
  display: inline-block;
  font-size: 10px;
  line-height: 1.5;
  padding: 1px 8px;
  border-radius: 20px;
  background: #f1f0ed;
  color: #566275;
  font-weight: 600;
  margin-right: 6px;
}
.event-row .m b {
  white-space: normal;
  overflow: visible;
}
.cal-agenda .row {
  margin-bottom: 6px;
}
.sh .bar {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: #f7f6f3;
  border-top: 1px solid #e8e3d9;
  margin: 20px 0 calc(-20px - env(safe-area-inset-bottom, 0px));
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px));
}
.sh .bar .btn {
  padding: 12px 14px;
}
.sh .bar .btn.s {
  flex: 1;
}
.sh .bar .btn.x {
  flex: none;
}

/* Update 11 */
.swipe-wrap {
  position: relative;
  margin: 8px 0;
  border-radius: 13px;
  overflow: hidden;
  touch-action: pan-y;
}
.swipe-wrap .event-row {
  margin: 0;
  position: relative;
  z-index: 1;
  transition: transform 0.22s ease;
  will-change: transform;
}
.swipe-wrap.dragging .event-row {
  transition: none;
}
.swipe-wrap .event-done {
  opacity: 1;
}
.swipe-wrap .event-done > * {
  opacity: 0.55;
}
.swipe-bg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: #e9e7e2;
}
.swipe-bg span {
  opacity: 0;
  transition: opacity 0.15s;
}
.swipe-wrap.to-right .swipe-bg {
  background: var(--ok);
}
.swipe-wrap.to-left .swipe-bg {
  background: var(--rd);
}
.swipe-wrap.to-right .sw-done,
.swipe-wrap.to-left .sw-del {
  opacity: 1;
}
.cal-add {
  display: grid;
  place-items: center;
}
.pick-grid .tile {
  min-height: 92px;
}

/* Erinnerungen in der Übersicht */
.reminder {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--gold-soft);
  border: 1px solid #e8dcc5;
  border-radius: 15px;
  padding: 10px 8px 10px 12px;
  margin-bottom: 8px;
}
.reminder .ic {
  background: #fff !important;
  color: #8b754e !important;
}
.reminder-main {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: none;
  border: 0;
  padding: 2px 0;
}
.reminder-main b {
  display: block;
  font-size: 14px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reminder-main small {
  display: block;
  font-size: 12px;
  color: #6b5a3a;
}

/* Konflikt-Vergleich */
.conflict-dialog {
  width: min(100%, 620px);
}
.cmp {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}
.cmp th,
.cmp td {
  text-align: left;
  vertical-align: top;
  padding: 8px 6px;
  border-bottom: 1px solid #efede8;
  overflow-wrap: anywhere;
}
.cmp thead th {
  font-size: 12px;
  color: #344256;
}
.cmp thead th small {
  display: block;
  font-weight: 400;
  color: var(--mu);
  font-size: 11px;
}
.cmp tbody th {
  width: 30%;
  color: var(--mu);
  font-weight: 600;
  font-size: 12px;
}
.conflict-foot {
  flex-wrap: wrap;
}
.conflict-foot button {
  flex: 1 1 140px;
}

.sh:focus {
  outline: none;
}

/* Klappbare Abschnitte in der Übersicht */
.home-fold > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 27px 2px 11px;
  cursor: pointer;
  user-select: none;
  border-radius: 8px;
}
.home-fold > summary::-webkit-details-marker {
  display: none;
}
.home-fold > summary h2 {
  margin: 0;
}
.home-fold > summary:after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 1.7px solid #7c8490;
  border-bottom: 1.7px solid #7c8490;
  transform: rotate(45deg);
  margin-left: auto;
  margin-right: 6px;
  margin-top: -4px;
  transition: transform 0.2s;
}
.home-fold[open] > summary:after {
  transform: rotate(225deg);
  margin-top: 4px;
}
.fold-count {
  font-size: 11px;
  font-weight: 650;
  color: #8b754e;
  background: var(--gold-soft);
  border-radius: 20px;
  padding: 1px 8px;
}

/* Icon-Buttons (z. B. Kategorien bearbeiten/löschen) */
.settings-item .icon-btn {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  padding: 0;
  background: #fff;
  border: 1px solid var(--ln);
  border-radius: 11px;
  color: #344256;
}
.settings-item .icon-btn:hover {
  background: #f5f2ec;
  border-color: var(--gold);
}
.settings-item .icon-btn.danger {
  color: var(--rd);
  background: #fbf5f4;
  border-color: #eadada;
}
.settings-item .icon-btn.danger:hover {
  background: #f6e9e7;
  border-color: #d9b4b4;
}
.settings-item .icon-btn .ui-icon {
  width: 18px;
  height: 18px;
}

/* Kurzer Hinweis unten (z. B. "Zum Beenden erneut zurück") */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(100px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 10px);
  z-index: 10001;
  max-width: calc(100% - 40px);
  padding: 10px 16px;
  border-radius: 22px;
  background: #202b3a;
  color: #f1dfb8;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(20, 31, 45, 0.25);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
}
.toast.on {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Abhaken-Knopf in der Terminliste */
.event-check {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1.5px solid #cfc8ba;
  background: #fff;
  color: transparent;
  font-size: 15px;
  font-weight: 700;
  padding: 0;
}
.event-check:hover {
  border-color: var(--ok);
  color: var(--ok);
}
.event-check.on {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}
.swipe-wrap .event-done > .event-check {
  opacity: 1;
}

/* Fristen-Liste im Eintrag */
.dl-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px;
  gap: 8px;
  align-items: end;
}
.dl-row .icon-btn {
  margin-bottom: 13px;
  width: 40px;
  height: 47px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 11px;
  border: 1px solid #eadada;
  background: #fbf5f4;
  color: var(--rd);
}
.dl-row .icon-btn .ui-icon {
  width: 18px;
  height: 18px;
}

/* Dokumente: Datei oder Kamera */
.doc-add {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.icon-text-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.doc-add .icon-text-btn {
  padding: 7px 12px;
  font-size: 12.5px;
  border-radius: 9px;
}
.icon-text-btn .ui-icon {
  width: 16px;
  height: 16px;
  color: var(--gold);
}
.ib .ui-icon {
  width: 19px;
  height: 19px;
}
.doc-actions .ib {
  display: grid;
  place-items: center;
}
.doc-actions .ib .ui-icon {
  width: 16px;
  height: 16px;
}
.event-check .ui-icon {
  width: 16px;
  height: 16px;
  stroke-width: 2.6;
}
.inline-ic {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 2px;
  vertical-align: -1px;
  stroke-width: 2;
}
.fav-ic {
  width: 14px;
  height: 14px;
  margin: 0 4px 0 0;
  vertical-align: -2px;
  fill: var(--gold);
  stroke: var(--gold);
}
.label-ic .ui-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  vertical-align: -3px;
  fill: var(--gold);
  stroke: var(--gold);
}
.version-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px 14px;
  margin: 0 0 12px;
  font-size: 13px;
}
.version-list dt {
  color: var(--mu);
}
.version-list dd {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.changelog h4 {
  margin: 14px 0 4px;
  font-size: 13px;
}
.changelog ul {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  color: var(--mu);
}
.changelog li {
  margin: 3px 0;
}

/* Preisverlauf im Eintrag */
.price-hist:empty {
  display: none;
}
.price-hist {
  background: var(--sf);
  border: 1px solid var(--ln);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 0 0 12px;
  font-size: 12px;
}
.price-hist b {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
}
.price-hist div {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  color: var(--mu);
}
.price-hist small {
  display: block;
  margin-top: 6px;
  font-weight: 700;
}
.price-hist small.up {
  color: var(--rd);
}
.price-hist small.down {
  color: var(--ok);
}

/* Spar-Hinweise in der Statistik */
.hint {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--sf);
  border: 1px solid var(--ln);
  border-left: 4px solid var(--gold);
  border-radius: 12px;
  padding: 11px 13px;
  margin-bottom: 8px;
}
.hint b {
  display: block;
  font-size: 13px;
}
.hint small {
  display: block;
  color: var(--mu);
  font-size: 12px;
  margin-top: 2px;
}

/* Fristen im Kalender */
.cal-day .dots i.dl {
  background: var(--rd);
}
.deadline-row .event-datebox {
  display: grid;
  place-items: center;
  min-height: 40px;
}
.event-badge.dl {
  background: #f6e3e3;
  color: #9a3f3f;
}

/* Hinweis-Toast mit Aktion */
.toast {
  display: flex;
  align-items: center;
  gap: 14px;
}
.toast.has-action {
  pointer-events: auto;
}
.toast button {
  background: none;
  border: 0;
  padding: 2px 0;
  color: #fff;
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Anleitungen im Drive-Dialog */
.guide {
  background: var(--sf);
  border: 1px solid var(--ln);
  border-radius: 12px;
  padding: 10px 13px;
  margin: 0 0 12px;
  font-size: 13px;
}
.guide summary {
  cursor: pointer;
  font-weight: 650;
}
.guide ol {
  margin: 10px 0 6px;
  padding-left: 20px;
}
.guide li {
  margin-bottom: 6px;
}

/* Segment-Auswahl (Darstellung) */
.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: #f1f0ed;
  border-radius: 12px;
  padding: 4px;
  margin-top: 12px;
}
.seg button {
  border: 0;
  background: transparent;
  border-radius: 9px;
  padding: 9px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--mu);
}
.seg button.on {
  background: var(--sf);
  color: var(--tx);
  box-shadow: 0 2px 6px rgba(20, 31, 45, 0.12);
}

/* Notfallmappe: nur im Druck sichtbar */
#printArea {
  display: none;
}
@media print {
  @page {
    margin: 16mm 14mm;
  }
  html,
  body {
    background: #fff !important;
    color: #111 !important;
    padding: 0 !important;
  }
  body > *:not(#printArea) {
    display: none !important;
  }
  #printArea {
    display: block;
    font:
      11pt/1.45 system-ui,
      -apple-system,
      "Segoe UI",
      sans-serif;
    color: #111;
  }
  #printArea h1 {
    font-size: 20pt;
    margin: 0 0 4px;
  }
  #printArea h2 {
    font-size: 13pt;
    margin: 18px 0 8px;
    padding-bottom: 4px;
    border-bottom: 2px solid #c6a76b;
    break-after: avoid;
  }
  #printArea h3 {
    font-size: 11.5pt;
    margin: 0 0 4px;
  }
  #printArea .pm-head p {
    margin: 0;
    color: #444;
  }
  #printArea .pm-warn {
    margin-top: 6px !important;
    font-weight: 700;
    color: #8a2f2f !important;
  }
  #printArea table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10pt;
  }
  #printArea th,
  #printArea td {
    text-align: left;
    padding: 4px 6px;
    border-bottom: 1px solid #ddd;
    vertical-align: top;
  }
  #printArea .pm-entry {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 8px;
    break-inside: avoid;
  }
  #printArea dl {
    display: grid;
    grid-template-columns: 34% 1fr;
    gap: 2px 10px;
    margin: 0;
    font-size: 10pt;
  }
  #printArea dt {
    color: #555;
  }
  #printArea dd {
    margin: 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
  }
}

/* ===== Dunkelmodus ===== */
html[data-theme="dark"] {
  --bg: #11161f;
  --sf: #1a212d;
  --tx: #e6e9ef;
  --mu: #9aa4b2;
  --ln: #2b3442;
  --gold-soft: #2a2519;
  --sd: 0 8px 24px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}
html[data-theme="dark"] h1 span,
html[data-theme="dark"] .sh h4,
html[data-theme="dark"] .fold-count,
html[data-theme="dark"] .settings-dialog-kicker {
  color: #d2b679;
}
html[data-theme="dark"] .ib {
  color: #aab3c0;
}
html[data-theme="dark"] .ib:hover,
html[data-theme="dark"] .bw {
  background: #252e3c;
}
html[data-theme="dark"] .hero {
  background: linear-gradient(135deg, #1e2a3b 0%, #121a26 100%);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
}
html[data-theme="dark"] .note,
html[data-theme="dark"] .reminder {
  background: #231f15;
  border-color: #4a3f27;
}
html[data-theme="dark"] .reminder-main small {
  color: #cdb88d;
}
html[data-theme="dark"] .row:hover,
html[data-theme="dark"] .tile:hover {
  border-color: #6f5f3c;
}
html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] .f input,
html[data-theme="dark"] .f select,
html[data-theme="dark"] .f textarea,
html[data-theme="dark"] #so,
html[data-theme="dark"] #docCat,
html[data-theme="dark"] .settings-select,
html[data-theme="dark"] .settings-dialog-body input,
html[data-theme="dark"] .settings-dialog-body textarea {
  background: #121822;
  border-color: #344052;
  color: var(--tx);
}
html[data-theme="dark"] .f span,
html[data-theme="dark"] .settings-dialog-body label,
html[data-theme="dark"] .settings-dialog-body p,
html[data-theme="dark"] .subcategory-editor-head {
  color: #aab3c0;
}
html[data-theme="dark"] .chip {
  background: var(--sf);
  border-color: #344052;
  color: #b8c0cc;
}
html[data-theme="dark"] .chip.on,
html[data-theme="dark"] .btn,
html[data-theme="dark"] .settings-dialog-foot .dialog-primary,
html[data-theme="dark"] .cal-day.selected {
  background: #d2b679;
  border-color: #d2b679;
  color: #17120a;
}
html[data-theme="dark"] .btn:hover {
  background: #e0c58f;
}
html[data-theme="dark"] .btn.s,
html[data-theme="dark"] .settings-item .icon-btn,
html[data-theme="dark"] .event-check {
  background: #1f2734;
  border-color: #3a4558;
  color: #dfe4ec;
}
html[data-theme="dark"] .btn.s:hover,
html[data-theme="dark"] .settings-item .icon-btn:hover {
  background: #283243;
}
html[data-theme="dark"] .btn.x {
  background: none;
  border-color: transparent;
  color: #e58a8a;
}
html[data-theme="dark"] .settings-item .icon-btn.danger,
html[data-theme="dark"] .dl-row .icon-btn,
html[data-theme="dark"] .subcategory-remove {
  background: #2a1a1c;
  border-color: #4d2a2e;
  color: #e58a8a;
}
html[data-theme="dark"] .add,
html[data-theme="dark"] .subcategory-add {
  background: #191f29;
  border-color: #5a4d30;
  color: #d2b679;
}
html[data-theme="dark"] nav {
  background: rgba(21, 27, 37, 0.97);
}
html[data-theme="dark"] nav button {
  color: #8e98a6;
}
html[data-theme="dark"] nav button.on {
  color: #f0f2f6;
}
html[data-theme="dark"] nav button.nav-add {
  color: #d2b679;
}
html[data-theme="dark"] nav button.nav-add span {
  background: #d2b679;
  color: #17120a;
}
html[data-theme="dark"] nav button.nav-add .ui-icon {
  color: #17120a;
}
html[data-theme="dark"] .sh,
html[data-theme="dark"] .sh .bar {
  background: #141a24;
}
html[data-theme="dark"] .sh h4,
html[data-theme="dark"] .sh .bar {
  border-color: #2b3442;
}
html[data-theme="dark"] .doc .doc-link,
html[data-theme="dark"] .cmp thead th,
html[data-theme="dark"] .settings-dialog-head h3 {
  color: #e6e9ef;
}
html[data-theme="dark"] .ic,
html[data-theme="dark"] .row .ic,
html[data-theme="dark"] .tile .ic {
  background: #232c3a !important;
  color: #d5dbe4 !important;
  border-color: #2f3948;
}
html[data-theme="dark"] .reminder .ic {
  background: #2f2919 !important;
  color: #d2b679 !important;
}
html[data-theme="dark"] .settings-section,
html[data-theme="dark"] .cal-day,
html[data-theme="dark"] .cal-card,
html[data-theme="dark"] .event-row,
html[data-theme="dark"] .settings-dialog {
  background: var(--sf);
  border-color: var(--ln);
}
html[data-theme="dark"] .settings-item,
html[data-theme="dark"] .settings-section .settings-content,
html[data-theme="dark"] .settings-dialog-foot,
html[data-theme="dark"] .cmp th,
html[data-theme="dark"] .cmp td {
  border-color: #2b3442;
}
html[data-theme="dark"] .settings-section > summary .set-icon {
  color: #d2b679;
}
html[data-theme="dark"] .settings-dialog-foot .dialog-secondary,
html[data-theme="dark"] .event-datebox,
html[data-theme="dark"] .event-badge,
html[data-theme="dark"] .seg {
  background: #232c3a;
  color: #cfd6df;
}
html[data-theme="dark"] .event-badge.dl {
  background: #3a2224;
  color: #f0a7a7;
}
html[data-theme="dark"] .swipe-bg {
  background: #252e3c;
}
html[data-theme="dark"] .event-check.on {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}
html[data-theme="dark"] .preview-body {
  background: #0d1118;
}
html[data-theme="dark"] .toast {
  background: #e6e9ef;
  color: #17120a;
}
html[data-theme="dark"] .toast button {
  color: #17120a;
}
html[data-theme="dark"] .settings-dialog-backdrop,
html[data-theme="dark"] .ov {
  background: rgba(0, 0, 0, 0.6);
}

/* Hell/Dunkel-Umschalter im Kopfbereich */
.theme-toggle {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 11px;
  border: 1px solid var(--ln);
  background: var(--sf);
  color: #697382;
}
.theme-toggle:hover {
  border-color: var(--gold);
  color: var(--tx);
}
.theme-toggle .ui-icon {
  width: 18px;
  height: 18px;
}
html[data-theme="dark"] .theme-toggle {
  color: #d2b679;
}
html[data-theme="dark"] #st:before {
  background-color: #5b6676;
}
html[data-theme="dark"] #st.ok:before {
  background-color: var(--ok);
}
html[data-theme="dark"] #st.busy:before {
  background-color: var(--wa);
}
html[data-theme="dark"] #st.err:before {
  background-color: var(--rd);
}

/* PDF-Vorschau (PDF.js) */
.preview-body.pdf-mode {
  display: block;
  align-items: initial;
  justify-content: initial;
}
.pdf-pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 12px;
  width: max-content;
  min-width: 100%;
}
.pdf-page {
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  flex: none;
}
.pdf-page canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.pdf-zoom {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
}
.pdf-zoom .ib {
  font-size: 17px;
  min-width: 34px;
  padding: 4px 6px;
}
.pdf-zoom .pdf-zoom-val {
  font-size: 12px;
  font-weight: 650;
  min-width: 54px;
}
.preview-actions .btn {
  text-align: center;
  text-decoration: none;
}
.preview-msg-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
  color: var(--mu);
}
.preview-msg .btn {
  display: block;
  margin-top: 14px;
  text-decoration: none;
  text-align: center;
}
@media (max-width: 420px) {
  .preview-actions .btn {
    padding: 11px 6px;
    font-size: 12px;
  }
}

/* Papierkorb */
.trash-list {
  margin-top: 6px;
}
.doc-meta .warn {
  color: var(--rd);
  font-weight: 650;
}

/* Objekt-Modell: Unterlagen-Gruppen, Kostenliste, Listen-Gruppen */
.doc-group {
  margin-bottom: 10px;
}
.doc-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 2px 2px;
  font-size: 13px;
  color: var(--tx);
}
.doc-group .doc {
  margin-top: 6px;
}
.doc-add-box {
  background: var(--gold-soft);
  border: 1px dashed #cfc4ae;
  border-radius: 12px;
  padding: 10px 12px 12px;
  margin: 8px 0 4px;
}
.doc-add-box .f {
  margin-bottom: 8px;
}
.doc-add-box .doc-add {
  margin-top: 0;
}
.cost-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px;
  grid-template-areas:
    "label label rm"
    "amount iv iv";
  gap: 0 8px;
  padding: 10px 0 2px;
  border-top: 1px solid var(--ln);
}
.cost-row:first-child {
  border-top: 0;
}
.cost-row .cost-label {
  grid-area: label;
}
.cost-row label:nth-of-type(2) {
  grid-area: amount;
}
.cost-row label:nth-of-type(3) {
  grid-area: iv;
}
.cost-row .icon-btn {
  grid-area: rm;
  align-self: end;
  margin-bottom: 13px;
  width: 40px;
  height: 47px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 11px;
  border: 1px solid #eadada;
  background: #fbf5f4;
  color: var(--rd);
}
.cost-row .icon-btn .ui-icon {
  width: 18px;
  height: 18px;
}
.list-tools {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 8px;
}
.list-tools select {
  width: auto;
  padding: 8px 11px;
  font-size: 12px;
  border: 1px solid #dedbd4;
  border-radius: 11px;
  background: var(--sf);
}
.list-group {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8b754e;
  margin: 16px 2px 8px;
}
html[data-theme="dark"] .doc-add-box {
  background: #191f29;
  border-color: #5a4d30;
}
html[data-theme="dark"] .cost-row .icon-btn {
  background: #2a1a1c;
  border-color: #4d2a2e;
  color: #e58a8a;
}
html[data-theme="dark"] .list-tools select {
  background: #121822;
  border-color: #344052;
  color: var(--tx);
}
html[data-theme="dark"] .list-group {
  color: #d2b679;
}
