/* Büro Berlin — panel pracy Waldka. Papier + atrament, jeden akcent: żółty zakreślacz na tym, co nowe. */
:root {
  --papier: #F4F6F4;
  --flaeche: #FFFFFF;
  --tinte: #15202B;
  --grafit: #56636F;
  --hell: #8A949C;
  --linie: #DCE1DC;
  --linie2: #C5CCC6;
  --marker: #FFD60A;
  --marker-weich: #FFF3B0;
  --aktion: #1B4D8F;
  --aktion-hell: #E7EEF7;
  --rot: #B42318;
  --rot-hell: #FCEDEB;
  --gruen: #1F7047;
  --gruen-hell: #E4F1E9;
  --rail: 232px;
  --kopf: 68px;
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--papier); color: var(--tinte);
  font: 400 15px/1.5 var(--font); font-stretch: 100%;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--aktion); }
:focus-visible { outline: 2px solid var(--aktion); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.leise { color: var(--grafit); }
.klein { font-size: 13px; }
.versteckt { display: none !important; }
h1, h2, h3 { font-stretch: 78%; font-weight: 760; letter-spacing: -0.01em; line-height: 1.1; margin: 0; }

/* Zakreślacz: pas pod tekstem, jak markerem po papierze */
.markiert {
  background: linear-gradient(180deg, transparent 52%, var(--marker) 52%, var(--marker) 90%, transparent 90%);
  box-decoration-break: clone; -webkit-box-decoration-break: clone; padding: 0 2px; margin: 0 -2px;
}

/* ---------- powłoka ---------- */
.shell { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }
.rail {
  background: var(--tinte); color: #E8ECEE; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; padding: 22px 14px 16px;
}
.marke { padding: 0 10px 22px; }
.marke b { display: block; font-size: 22px; font-stretch: 75%; font-weight: 800; letter-spacing: -0.01em; }
.marke span { font-size: 13px; color: #A9B4BC; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 10px; border-radius: 8px; color: #D7DEE2; text-decoration: none; font-weight: 520;
}
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a[aria-current="page"] { background: rgba(255, 255, 255, .1); color: #fff; box-shadow: inset 3px 0 0 var(--marker); }
.zahl {
  min-width: 24px; padding: 1px 7px; border-radius: 999px; text-align: center;
  background: var(--marker); color: var(--tinte); font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.rail-fuss { margin-top: auto; display: flex; flex-direction: column; gap: 2px; border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 12px; }
.rail-fuss .wer { padding: 4px 10px 8px; font-size: 13px; color: #A9B4BC; }
.rail-fuss button {
  text-align: left; background: none; border: 0; color: #C9D2D8; padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.rail-fuss button:hover { background: rgba(255, 255, 255, .06); color: #fff; }

.haupt { min-width: 0; display: flex; flex-direction: column; }
.kopf {
  min-height: var(--kopf); display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 28px; border-bottom: 1px solid var(--linie); background: var(--papier);
}
.kopf h1 { font-size: 30px; margin-right: auto; }
.mkopf, .tabbar { display: none; }

/* ---------- elementy ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--linie2);
  background: var(--flaeche); color: var(--tinte); cursor: pointer; font-weight: 560; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--grafit); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primaer { background: var(--aktion); border-color: var(--aktion); color: #fff; }
.btn-primaer:hover { background: #163F76; border-color: #163F76; }
.btn-warn { background: var(--marker); border-color: #E5BF00; color: var(--tinte); }
.btn-klein { min-height: 32px; padding: 4px 10px; font-size: 14px; }
.seg { display: inline-flex; border: 1px solid var(--linie2); border-radius: 8px; overflow: hidden; background: var(--flaeche); }
.seg button { border: 0; background: none; padding: 7px 12px; cursor: pointer; font-weight: 540; color: var(--grafit); }
.seg button + button { border-left: 1px solid var(--linie); }
.seg button[aria-pressed="true"] { background: var(--tinte); color: #fff; }
.feld, select.feld, textarea.feld {
  width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid var(--linie2); border-radius: 8px; background: var(--flaeche);
}
textarea.feld { min-height: 150px; resize: vertical; line-height: 1.5; }
.feld:focus { outline: 2px solid var(--aktion); outline-offset: 0; border-color: var(--aktion); }
.suche { max-width: 260px; }
label.lbl { display: block; font-size: 13px; color: var(--grafit); margin: 10px 0 4px; font-weight: 540; }
.hinweis { padding: 12px 14px; border-radius: 10px; background: var(--marker-weich); border: 1px solid #F0D766; font-size: 14px; }
.hinweis.rot { background: var(--rot-hell); border-color: #F2C1BC; }
.hinweis.blau { background: var(--aktion-hell); border-color: #C9D8EC; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #EBEEEB; color: var(--grafit); white-space: nowrap; }
.badge.rot { background: var(--rot-hell); color: var(--rot); }
.badge.gruen { background: var(--gruen-hell); color: var(--gruen); }
.badge.gelb { background: var(--marker); color: var(--tinte); }
.badge.blau { background: var(--aktion-hell); color: var(--aktion); }
.leer { padding: 48px 24px; text-align: center; color: var(--grafit); }
.laedt { padding: 28px; color: var(--grafit); }

/* ---------- Übersicht: księga zamiast kafelków ---------- */
.ue { padding: 28px; max-width: 980px; }
.ue h2 { font-size: 40px; margin-bottom: 4px; }
.ue .datum { color: var(--grafit); margin-bottom: 28px; }
.buch { border-top: 2px solid var(--tinte); }
.posten {
  display: grid; grid-template-columns: 132px 1fr auto; align-items: center; gap: 18px;
  padding: 16px 4px; border-bottom: 1px solid var(--linie); text-decoration: none; color: inherit;
}
a.posten:hover { background: var(--flaeche); }
.posten .gross { font-size: 60px; line-height: 1; font-weight: 800; font-stretch: 75%; font-variant-numeric: tabular-nums; }
.posten .gross.null { color: var(--linie2); }
.posten .was { font-size: 19px; font-weight: 560; }
.posten .was small { display: block; font-size: 14px; font-weight: 400; color: var(--grafit); margin-top: 2px; }
.posten .was small.rot { color: var(--rot); font-weight: 560; }
.posten .pfeil { color: var(--grafit); font-size: 14px; }
.ue h3 { font-size: 22px; margin: 36px 0 10px; }
.kurz { border-top: 1px solid var(--linie); }

/* ---------- listy + szczegóły ---------- */
.split { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; flex: 1; min-height: 0; height: calc(100vh - var(--kopf)); }
.split3 { grid-template-columns: 220px minmax(300px, 400px) 1fr; }
.spalte { overflow-y: auto; min-height: 0; border-right: 1px solid var(--linie); background: var(--papier); }
.liste { background: var(--flaeche); }
.filterleiste { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--linie); background: var(--papier); position: sticky; top: 0; z-index: 2; }
.zeile {
  display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--linie);
  padding: 12px 16px 13px; cursor: pointer; color: inherit;
}
.zeile:hover { background: #F8FAF8; }
.zeile[aria-current="true"] { background: var(--aktion-hell); box-shadow: inset 3px 0 0 var(--aktion); }
.zeile .oben { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--grafit); }
.zeile .titel { font-weight: 560; margin: 2px 0 1px; overflow-wrap: anywhere; }
.zeile.neu .titel { font-weight: 720; }
.zeile .vorschau { font-size: 13.5px; color: var(--grafit); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.zeile .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.konten { padding: 10px 8px; }
.konto-btn {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; text-align: left;
  border: 0; background: none; padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--tinte);
}
.konto-btn:hover { background: #E9EDE9; }
.konto-btn[aria-current="true"] { background: var(--tinte); color: #fff; }
.konto-btn .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.konto-btn .name small { display: block; font-size: 11.5px; color: var(--hell); }
.konto-btn[aria-current="true"] .name small { color: #B7C1C8; }
.ordner { padding: 6px 8px 12px; border-top: 1px solid var(--linie); margin-top: 6px; }

.detail { overflow-y: auto; min-height: 0; background: var(--papier); }
.detail-innen { padding: 24px 28px 48px; max-width: 860px; }
.detail-zurueck { display: none; }
.detail h2 { font-size: 28px; margin-bottom: 6px; overflow-wrap: anywhere; }
.meta { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 14px; margin: 14px 0; }
.meta dt { color: var(--grafit); }
.meta dd { margin: 0; overflow-wrap: anywhere; }
.aktionen { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.blatt { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 12px; padding: 18px 20px; margin: 14px 0; }
.blatt h3 { font-size: 19px; margin-bottom: 8px; }
.text { white-space: pre-wrap; overflow-wrap: anywhere; }
.mail-frame { width: 100%; border: 0; min-height: 200px; background: #fff; border-radius: 8px; }
.verlauf-eintrag { border-left: 3px solid var(--linie2); padding: 6px 0 6px 12px; margin: 10px 0; }
.verlauf-eintrag.aus { border-left-color: var(--aktion); }

/* kompozytor */
.komponist { background: var(--flaeche); border: 1px solid var(--linie2); border-radius: 12px; padding: 16px 18px; margin-top: 18px; }
.komponist h3 { font-size: 20px; }
.ki-reihe { display: flex; gap: 8px; margin: 10px 0 2px; }
.ki-reihe .feld { flex: 1; }
.fuss { display: flex; gap: 10px; align-items: center; justify-content: flex-end; flex-wrap: wrap; margin-top: 12px; }

/* telefon */
.gespraech-kopf { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
audio { width: 100%; margin-top: 6px; }
.abschrift { white-space: pre-wrap; font-size: 14px; line-height: 1.6; max-height: 520px; overflow-y: auto; }
.felder { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14.5px; }
.felder dt { color: var(--grafit); }
.felder dd { margin: 0; }

/* lexware */
.lx { padding: 20px 28px 48px; }
.lx-summe { display: flex; gap: 18px; flex-wrap: wrap; align-items: baseline; margin: 4px 0 14px; font-size: 15px; }
.lx-summe .rot { color: var(--rot); font-weight: 600; }
.tabelle { width: 100%; border-collapse: collapse; background: var(--flaeche); border: 1px solid var(--linie); }
.tabelle th { text-align: left; font-size: 13px; font-weight: 600; color: var(--grafit); padding: 10px 12px; border-bottom: 2px solid var(--tinte); background: var(--papier); }
.tabelle td { padding: 10px 12px; border-bottom: 1px solid var(--linie); vertical-align: top; }
.tabelle .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabelle tr.ueber td:first-child { box-shadow: inset 3px 0 0 var(--rot); }
.verbinden { max-width: 620px; margin: 40px 28px; }
.verbinden h2 { font-size: 30px; margin-bottom: 10px; }

.schritte { margin: 8px 0 6px; padding-left: 22px; }
.schritte li { margin: 4px 0; }
.schalter { display: flex; align-items: center; gap: 10px; margin: 10px 0; font-size: 15px; cursor: pointer; }
.schalter input { width: 20px; height: 20px; accent-color: var(--aktion); }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }

/* logowanie */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login { width: 100%; max-width: 380px; }
.login .marke-gross { font-size: 44px; font-weight: 800; font-stretch: 75%; line-height: 1; margin-bottom: 4px; }
.login .unter { color: var(--grafit); margin-bottom: 26px; }
.login .btn { width: 100%; margin-top: 18px; min-height: 44px; }
.login .sprachwahl { margin-top: 22px; text-align: center; }
.linkbtn { background: none; border: 0; color: var(--aktion); cursor: pointer; padding: 4px; text-decoration: underline; }
.fehlertext { color: var(--rot); font-size: 14px; margin-top: 10px; min-height: 1.4em; }

/* dialog */
.dialog-hg { position: fixed; inset: 0; background: rgba(21, 32, 43, .45); display: grid; place-items: center; z-index: 60; padding: 16px; }
.dialog { background: var(--papier); border-radius: 14px; padding: 22px; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; }
.dialog h2 { font-size: 26px; margin-bottom: 6px; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: var(--tinte); color: #fff; padding: 11px 18px; border-radius: 10px; z-index: 80; max-width: calc(100vw - 32px);
  transition: opacity .18s, transform .18s; font-size: 14.5px;
}
#toast.zeigen { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.rot { background: var(--rot); }

/* ---------- telefon / wąski ekran ---------- */
@media (max-width: 960px) {
  .split3 { grid-template-columns: minmax(280px, 380px) 1fr; }
  .split3 > .konten-spalte { display: none; }
  .konten-chips { display: flex !important; }
}
.konten-chips { display: none; gap: 6px; overflow-x: auto; padding: 10px 14px 0; background: var(--papier); scrollbar-width: none; }
.konten-chips button { flex: none; border: 1px solid var(--linie2); background: var(--flaeche); border-radius: 999px; padding: 5px 11px; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.konten-chips button[aria-pressed="true"] { background: var(--tinte); color: #fff; border-color: var(--tinte); }
.konten-chips .zahl { margin-left: 4px; }

@media (max-width: 760px) {
  body { font-size: 15.5px; }
  .shell { display: block; }
  .rail { display: none; }
  .mkopf {
    display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20;
    background: var(--tinte); color: #fff; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  }
  .mkopf b { font-size: 19px; font-stretch: 75%; font-weight: 800; }
  .mkopf button { background: none; border: 1px solid rgba(255, 255, 255, .25); color: #fff; border-radius: 8px; padding: 5px 10px; }
  .kopf { padding: 12px 16px; min-height: 0; }
  .kopf h1 { font-size: 26px; }
  .suche { max-width: none; flex: 1 1 100%; }
  .haupt { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--flaeche); border-top: 1px solid var(--linie2); padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 58px; text-decoration: none; color: var(--grafit); font-size: 11.5px; font-weight: 600;
  }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a[aria-current="page"] { color: var(--tinte); }
  .tabbar a[aria-current="page"]::before { content: ''; position: absolute; top: 0; left: 22%; right: 22%; height: 3px; background: var(--marker); border-radius: 0 0 3px 3px; }
  .tabbar .zahl { position: absolute; top: 5px; left: 54%; min-width: 18px; padding: 0 5px; font-size: 11px; }
  .split, .split3 { display: block; height: auto; }
  .spalte { border-right: 0; overflow: visible; }
  .detail { display: none; }
  .detail.offen {
    display: block; position: fixed; inset: 0; z-index: 50; overflow-y: auto;
    padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
  }
  .detail-zurueck {
    display: flex; align-items: center; position: sticky; top: 0; z-index: 3; background: var(--tinte); color: #fff;
    padding: 10px 12px; gap: 8px;
  }
  .detail-zurueck button { background: none; border: 0; color: #fff; font-weight: 600; padding: 6px 4px; cursor: pointer; }
  .detail-innen { padding: 16px 16px 40px; }
  .detail h2 { font-size: 24px; }
  .ue { padding: 18px 16px; }
  .ue h2 { font-size: 30px; }
  .posten { grid-template-columns: 76px 1fr; gap: 12px; padding: 14px 2px; }
  .posten .gross { font-size: 42px; }
  .posten .pfeil { display: none; }
  .lx { padding: 14px 12px 40px; }
  .tabelle thead { display: none; }
  .tabelle, .tabelle tbody, .tabelle tr, .tabelle td { display: block; width: 100%; }
  .tabelle tr { padding: 10px 12px; border-bottom: 1px solid var(--linie); }
  .tabelle td { border: 0; padding: 1px 0; }
  .tabelle td.r { text-align: left; }
  .tabelle td[data-l]::before { content: attr(data-l) ': '; color: var(--grafit); font-size: 13px; }
  .tabelle tr.ueber { box-shadow: inset 3px 0 0 var(--rot); }
  .tabelle tr.ueber td:first-child { box-shadow: none; }
  .verbinden { margin: 24px 16px; }
  #toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
