/* Paket «Datei und Austausch»: Dialoge, Ablagefläche, Notizen, Bericht und Druck. */

/* ---------- Dialoge ---------- */
.dt-dialog .dt-inhalt { display: grid; gap: 10px; }
.dt-dialog .dt-inhalt > .hinweis { margin: 0; }
.dt-zeile { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 10px; align-items: center; }
.dt-label { color: var(--muted); font-size: var(--gr-panel); }
.dt-optionen { display: grid; gap: 8px; }
.dt-optionen select { justify-self: start; min-width: 160px; }
.dt-spalten { max-height: min(42vh, 360px); overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.dt-spaltentabelle { font-size: var(--gr-panel); }
.dt-spaltentabelle th { position: sticky; top: 0; background: var(--glass-strong); font-size: var(--gr-klein); color: var(--muted); font-weight: 500; }
.dt-spaltentabelle td { padding: 4px 8px; vertical-align: middle; }
.dt-spaltentabelle td:first-child, .dt-spaltentabelle th:first-child { width: 30px; }
.dt-spaltentabelle input[type="text"] { width: 100%; min-width: 90px; font-family: var(--schrift-text); }
.dt-spaltentabelle .dt-einheit { min-width: 60px; max-width: 110px; font-family: var(--schrift-mono); }
.dt-probe { font-family: var(--schrift-mono); font-size: var(--gr-klein); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.dt-teilen { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.dt-teilen > div { display: grid; gap: 4px; }
.dt-teilen .hinweis { margin: 0; }
@media (max-width: 560px) {
  .dt-zeile { grid-template-columns: 1fr; gap: 4px; }
  .dt-probe { max-width: 110px; }
}

/* Werkzeuge an Tabelle und Graph */
.dt-dezimal { font-family: var(--schrift-mono); font-size: var(--gr-klein); min-height: 30px; padding: 4px 6px; border-radius: 999px; }
.dt-bild { border-color: transparent; background: transparent; }
@media (pointer: coarse) { .dt-dezimal { min-height: 44px; } }

/* Unsichtbare Tabelle für das Kopieren über execCommand */
.dt-kopie { position: fixed; left: -10000px; top: 0; opacity: 0; pointer-events: none; }

/* ---------- Ablegen ---------- */
.dt-ablage {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; pointer-events: none;
  background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(2px);
}
.dt-ablage-box {
  display: grid; gap: 6px; justify-items: center; padding: 34px 46px; border-radius: 18px;
  border: 2px dashed var(--accent); background: var(--glass-strong); box-shadow: var(--shadow);
}
.dt-ablage-box b { font-family: var(--schrift-titel); font-weight: 600; font-size: var(--gr-panel-titel); }
.dt-ablage-box span { color: var(--muted); font-family: var(--schrift-mono); font-size: var(--gr-klein); }

/* ---------- Notizen ---------- */
.dt-notizen .segment { margin-bottom: 8px; }
.notizen-feld {
  width: 100%; min-height: 96px; resize: vertical; display: block;
  font: inherit; font-family: var(--schrift-text); font-size: var(--gr-panel); line-height: 1.45; color: var(--text);
  background: var(--btn); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px;
}
.notizen-feld::placeholder { color: var(--faint); }
.notizen-vorschau { font-size: var(--gr-panel); line-height: 1.5; min-height: 40px; overflow-wrap: anywhere; }
.notizen-vorschau h3, .notizen-vorschau h4, .notizen-vorschau h5 { font-family: var(--schrift-titel); font-weight: 600; margin: 8px 0 4px; font-size: var(--gr-text); }
.notizen-vorschau h3 { font-size: var(--gr-titel); }
.notizen-vorschau p { margin: 0 0 6px; }
.notizen-vorschau ul, .notizen-vorschau ol { margin: 0 0 6px; padding-left: 20px; }
.notizen-vorschau code, .bericht code { font-family: var(--schrift-mono); font-size: .92em; }

/* ---------- Bericht (Vorschau als Papierblatt, gedruckt ohne alles andere) ---------- */
.bericht-huelle { position: fixed; inset: 0; z-index: 70; overflow: auto; background: var(--bg); display: flex; flex-direction: column; align-items: center; }
.bericht-leiste {
  position: sticky; top: 0; z-index: 1; width: 100%; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--glass-strong); border-bottom: 1px solid var(--line);
}
.bericht-leiste b { font-family: var(--schrift-titel); font-weight: 600; font-size: var(--gr-titel); }
.bericht-leiste .hinweis { margin: 0 auto 0 0; }
/* Das Blatt ist Papier: immer schwarz auf weiss, wie gedruckt */
.bericht {
  width: min(210mm, calc(100vw - 24px)); margin: 18px 0 40px; padding: 16mm 15mm; background: #fff; color: #1a1d23;
  box-shadow: var(--shadow); border-radius: 4px; font-family: var(--schrift-text); font-size: var(--gr-text); line-height: 1.45;
}
.bericht h1 { font-family: var(--schrift-titel); font-weight: 600; font-size: var(--gr-panel-titel); margin: 0 0 2px; }
.bericht h2 { font-family: var(--schrift-titel); font-weight: 600; font-size: var(--gr-titel); margin: 16px 0 6px; border-bottom: 1px solid #d6d8dc; padding-bottom: 2px; }
.bericht h3 { font-family: var(--schrift-titel); font-weight: 600; font-size: var(--gr-text); margin: 10px 0 4px; }
.bericht h4, .bericht h5 { font-size: var(--gr-text); margin: 8px 0 4px; }
.bericht p { margin: 0 0 6px; }
.bericht ul, .bericht ol { margin: 0 0 6px; padding-left: 18px; }
.b-meta { color: #5c6370; font-size: var(--gr-klein); }
.b-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 18px; }
.bericht .b-graph { margin: 14px 0; break-inside: avoid; }
.bericht .b-graph img { width: 100%; height: auto; display: block; border: 1px solid #e3e5e8; }
.b-ergebnis { break-inside: avoid; margin-bottom: 8px; }
.bericht table { border-collapse: collapse; font-size: var(--gr-klein); }
.b-werte th, .b-werte td { text-align: left; padding: 2px 10px 2px 0; border-bottom: 1px solid #eceef0; font-weight: 400; }
.b-werte th { color: #5c6370; }
.b-werte td { font-family: var(--schrift-mono); }
.b-tabelle table { width: 100%; font-family: var(--schrift-mono); font-variant-numeric: tabular-nums; }
.b-tabelle th { font-family: var(--schrift-text); font-weight: 600; text-align: right; padding: 3px 6px; border-bottom: 1px solid #b9bdc3; }
.b-tabelle th[colspan] { text-align: center; border-bottom-color: #d6d8dc; }
.b-tabelle td { text-align: right; padding: 1px 6px; border-bottom: 1px solid #f0f1f3; }
.b-tabelle thead { display: table-header-group; }
.b-tabelle tr { break-inside: avoid; }
.b-hinweis { color: #5c6370; font-size: var(--gr-klein); margin-top: 6px; }
body.hat-bericht .app { visibility: hidden; }

@media print {
  @page { size: A4; margin: 14mm 13mm; }
  html, body { height: auto !important; overflow: visible !important; background: #fff !important; }
  body.hat-bericht > *:not(.bericht-huelle) { display: none !important; }
  body.hat-bericht .bericht-huelle { position: static; overflow: visible; background: #fff; display: block; }
  body.hat-bericht .bericht-leiste { display: none; }
  body.hat-bericht .bericht { width: auto; margin: 0; padding: 0; box-shadow: none; border-radius: 0; }
}
