/* ==========================================================================
   Terminal (js/views/terminal.js): Vollbild wie Excel, Optik wie die Excel-Ansicht der Objekt-Tabelle
   ========================================================================== */
html.terminal-offen #head, html.terminal-offen #side, html.terminal-offen .tabbar, html.terminal-offen .sr { display: none !important; }
html.terminal-offen, html.terminal-offen body { overflow: hidden; }
.term { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: var(--card); color: var(--ink);
  --tz-h: 32px; --tz-schrift: 13px; padding-top: env(safe-area-inset-top, 0px); }
/* Leiste oben */
.term-leiste { display: flex; align-items: center; gap: 4px; padding: 6px 10px; background: var(--card); border-bottom: 1px solid var(--line); min-height: 48px; flex: none; }
.term-zurueck { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border: 0; border-radius: var(--r-mittel); background: transparent; color: var(--ink-2); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; flex: none; }
.term-zurueck:hover { background: var(--inset); color: var(--ink); }
.term-titel { display: flex; flex-direction: column; justify-content: center; min-width: 0; padding: 0 8px; margin-right: auto; }
.term-titel b { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term-titel .label { font-size: 11.5px; }
.term-suche { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border-radius: var(--r-mittel); background: var(--inset); color: var(--ink-3); width: min(260px, 26vw); }
.term-suche input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 13.5px; color: var(--ink); outline: none; }
.term-suche:focus-within { box-shadow: var(--ring); }
.term-k { width: 34px; height: 34px; border: 0; border-radius: var(--r-mittel); background: transparent; color: var(--ink-2); display: grid; place-items: center; cursor: pointer; flex: none; }
.term-k:hover { background: var(--inset); color: var(--ink); }
.term-k:disabled { opacity: .35; cursor: default; background: transparent; }
.term-k.an { color: var(--accent-text); background: var(--accent-soft); }
.term-k:focus-visible, .term-zurueck:focus-visible { outline: none; box-shadow: var(--ring); }
.term-trenner { width: 1px; height: 22px; background: var(--line); margin: 0 4px; flex: none; }
.term-export { margin-left: 6px; flex: none; }
.term-umbruch { display: none; }
@media (max-width: 760px) { .term-umbruch { display: block; } }
/* Bearbeitungszeile und Erklärzeile: Bausteine der Objekt-Tabelle (.xg-bar, .xg-name, .xg-fx, .xg-klar in css/objekt.css) */
.term-fx { display: flex; flex-direction: column; gap: 4px; padding: 8px 12px 6px; background: var(--card); border-bottom: 1px solid var(--line); flex: none; }
.term-fx .xg-fx { padding-left: 10px; }
.term-fx-wert { display: flex; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term-fx.ber .term-fx-wert { color: var(--ink-3); }
.term-klar svg { flex: none; }
.term-klar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Raster: genau wie die Excel-Ansicht der Objekt-Tabelle. Weiß, feine Linien (--xg-line),
   nur Eingaben getönt (.a-in, --in-tint); Kopf wie .xg-ch und .a-kopf; Auswahl als Rahmen in Akzentfarbe. */
.term-grid { position: relative; flex: 1; min-height: 0; overflow: auto; background: var(--card); outline: none; font-size: var(--tz-schrift); overscroll-behavior: contain; }
.term-grid.rein { animation: term-rein var(--dauer-2) ease; }
@keyframes term-rein { from { opacity: .3; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.tg-kopf { position: sticky; top: 0; z-index: 5; height: 54px; background: var(--inset); box-shadow: 0 1px 0 var(--line-2); }
.tg-ecke { position: sticky; left: 0; top: 0; z-index: 6; height: 54px; background: var(--inset); box-shadow: 1px 0 0 var(--line-2); float: left; }
.tg-kz { position: absolute; top: 0; height: 54px; padding: 0; border-right: 1px solid var(--xg-line); background: var(--inset); cursor: pointer; display: flex; flex-direction: column; overflow: hidden; }
.tg-buchst { height: 26px; line-height: 26px; text-align: center; font-size: 11px; color: var(--ink-3); border-bottom: 1px solid var(--xg-line); flex: none; }
.tg-kt { height: 28px; line-height: 27px; padding: 0 8px; font-size: 11.5px; font-weight: 600; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-kz:hover .tg-kt { color: var(--ink-2); }
.tg-kz.on .tg-buchst { color: var(--accent-text); background: var(--accent-soft); font-weight: 600; }
.tg-kz.num .tg-kt { text-align: right; }
.tg-f { font-style: italic; color: var(--ink-3); margin-right: 4px; font-weight: 600; }
.tg-schloss { display: inline-flex; vertical-align: -1px; margin-right: 4px; color: var(--ink-3); }
.tg-ks { position: absolute; right: 8px; bottom: 7px; font-size: 11px; color: var(--accent-text); display: inline-flex; gap: 2px; }
.tg-kz.gefiltert .tg-buchst { color: var(--accent-text); }
.tg-griff { position: absolute; top: 0; right: -4px; width: 8px; height: 100%; cursor: col-resize; z-index: 2; }
.tg-griff:hover { background: var(--line-2); }
.tg-koerper { position: relative; }
.tg-z { position: absolute; left: 0; height: var(--tz-h); }
.tg-rn { position: sticky; left: 0; z-index: 3; height: var(--tz-h); line-height: var(--tz-h); text-align: center; font-size: 11px; color: var(--ink-3); background: var(--inset); border-bottom: 1px solid var(--xg-line); box-shadow: 1px 0 0 var(--line-2); float: left; font-variant-numeric: tabular-nums; cursor: pointer; }
.tg-rn.on { color: var(--accent-text); background: var(--accent-soft); font-weight: 600; }
/* Zellen: .xc aus css/objekt.css; hier nur Höhe, Position und das Verhalten */
.tg-c { position: absolute; top: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-c.xc { top: 0; height: var(--tz-h); line-height: calc(var(--tz-h) - 1px); font-size: var(--tz-schrift); background: var(--card); cursor: cell; }
.tg-c.xc.a-in { background: var(--in-tint); cursor: text; }
.tg-c.xc.a-in:hover { box-shadow: inset 0 0 0 1px var(--in-line); }
.tg-c.ber, .tg-c.ro { cursor: default; }
.tg-c.ro { color: var(--ink-2); }
.term[data-stil="zebra"] .tg-z.ungerade .tg-c:not(.a-in) { background: var(--prog-tint); }
.term.ohne-gitter .tg-c.xc { border-color: transparent; }
.tg-c.link { color: var(--accent-text); font-weight: 600; cursor: pointer; }
.tg-c.sel { background-image: linear-gradient(rgba(var(--accent-rgb), .08), rgba(var(--accent-rgb), .08)); }
.tg-c.akt { box-shadow: inset 0 0 0 2px var(--accent); border-radius: var(--r-klein); z-index: 4; }
.tg-c.akt.a-in:hover { box-shadow: inset 0 0 0 2px var(--accent); }
.tg-c.fix-ende, .tg-kz.fix-ende { box-shadow: 6px 0 10px -8px rgba(0, 0, 0, .25); }
.tg-c.akt.fix-ende { box-shadow: inset 0 0 0 2px var(--accent); }
.tg-c.blitz { animation: term-blitz 1s ease; }
@keyframes term-blitz { from { background-color: var(--accent-soft); } }
/* Editor wie .xg-ed */
.tg-editor { position: absolute; z-index: 8; border: 2px solid var(--accent); border-radius: var(--r-klein); box-shadow: var(--shadow-pop); background: var(--card); overflow: hidden; }
.tg-editor input, .tg-editor select { width: 100%; height: 100%; border: 0; padding: 0 7px; font: inherit; font-size: var(--tz-schrift); background: var(--card); color: var(--ink); outline: none; font-variant-numeric: tabular-nums; }
.tg-editor input.num { text-align: right; }
.tg-editor input.fehler { background: var(--warn-soft); }
.tg-summe { position: sticky; bottom: 0; z-index: 5; height: var(--tz-h); background: var(--inset); box-shadow: 0 -1px 0 var(--line-2); }
.tg-summe[hidden] { display: none; }
.tg-summe .tg-c.xc { background: var(--inset); font-weight: 650; cursor: default; color: var(--ink); }
.tg-summe .tg-rn { cursor: default; }
.tg-leer { position: absolute; left: 70px; top: 24px; color: var(--ink-3); margin: 0; }
/* Reiter unten */
.term-reiter { display: flex; align-items: stretch; gap: 0; height: 42px; background: var(--inset); border-top: 1px solid var(--line-2); flex: none; padding: 0 6px calc(env(safe-area-inset-bottom, 0px)); }
.tr-liste { display: flex; align-items: stretch; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.tr-liste::-webkit-scrollbar { display: none; }
.tr-reiter { display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--ink-2); font: inherit; font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; position: relative; transition: color var(--dauer-2) ease, background-color var(--dauer-2) ease; }
.tr-reiter em { font-style: normal; font-size: 11px; color: var(--ink-3); font-weight: 500; }
.tr-reiter:hover { color: var(--ink); background: var(--hover, var(--line)); }
.tr-reiter.an { background: var(--card); color: var(--ink); box-shadow: inset 0 2px 0 var(--accent); }
.tr-reiter.an em { color: var(--accent-text); }
.tr-reiter.eigen span::before { content: '◇ '; color: var(--ink-3); }
.tr-reiter.zieht { opacity: .4; }
.tr-reiter.ziel { box-shadow: inset 3px 0 0 var(--accent); }
.tr-reiter:focus-visible, .tr-plus:focus-visible { outline: none; box-shadow: var(--ring); }
.tr-plus { width: 42px; flex: none; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; display: grid; place-items: center; }
.tr-plus:hover { color: var(--accent-text); }
/* Menüs und Einstellungen */
.term-filter { display: flex; flex-direction: column; gap: 8px; width: 240px; padding: 4px; }
.term-spalten { display: flex; flex-direction: column; gap: 2px; max-height: 360px; overflow: auto; min-width: 220px; }
.term-spalte { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 6px; font-size: 13.5px; cursor: pointer; border-radius: var(--r-klein); }
.term-spalte:hover { background: var(--inset); }
.term-spalte input { width: 16px; height: 16px; accent-color: var(--accent); }
.term-ein { display: flex; flex-direction: column; gap: 18px; }
.term-ein-gruppe { display: flex; flex-direction: column; gap: 6px; }
.term-ein-gruppe .h3 { margin: 0 0 4px; }
.term-ein-zeile { display: flex; align-items: center; gap: 8px; min-height: 40px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.term-ein-zeile > span:first-child { flex: 1; min-width: 120px; }
.term-ein-liste { max-height: 300px; overflow: auto; }
/* Handy */
@media (max-width: 760px) {
  .term-leiste { flex-wrap: wrap; gap: 2px; padding: 6px; }
  .term-zurueck span { display: none; }
  .term-zurueck { order: 0; }
  .term-titel { order: 1; flex: 1 1 0; margin-right: 0; }
  .term-export { order: 2; }
  .term-umbruch { order: 3; flex-basis: 100%; height: 0; }
  .term-k { order: 4; }
  .term-suche { order: 10; width: 100%; flex: 1 1 100%; margin-top: 4px; }
  .term-export span { display: none; }
  .term-export { width: 36px; padding: 0; justify-content: center; }
  .term-trenner { display: none; }
  .term-k { width: 40px; height: 40px; }
  .term-fx { padding: 6px var(--rand, 12px); }
  .tr-reiter { padding: 0 12px; }
}
