/* Tripfile Studio Graphit. Alle Bausteine; Werte kommen nur aus tokens.css */
body { margin: 0; background: var(--bg-panel); color: var(--text); font: 400 14px/20px var(--font-sans); }
[hidden] { display: none !important; } /* sonst schlägt display der Bausteine das hidden-Attribut */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tf-ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tf-muted { color: var(--text-muted); }
.tf-mono { font-family: var(--font-mono); }

/* Knöpfe */
.tf-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-1); height: var(--h-control); border: 0; border-radius: var(--radius-m); background: var(--bg-control); color: var(--text); font: 500 14px/20px var(--font-sans); padding: 0 10px; cursor: pointer; }
.tf-btn:hover { background: var(--bg-hover); }
.tf-dialog > .tf-field > .tf-sel { background: var(--bg-app); } /* gleiche Fläche wie das Eingabefeld darüber */
.tf-float .tf-btn { background: var(--bg-hover); } /* auf schwebenden Flächen eine Stufe heller, sonst verschwindet der Knopf */
.tf-float .tf-btn:hover { box-shadow: inset 0 0 0 1px var(--text-muted); }
.tf-btn.danger { background: none; color: var(--danger); }
.tf-btn:disabled { color: var(--text-muted); background: none; cursor: default; }
.tf-btn.wide { width: 100%; }
.tf-primary { height: var(--h-primary); border: 0; border-radius: var(--radius-l); background: var(--accent); color: var(--on-accent); font: 600 15px/20px var(--font-sans); padding: 0 16px; cursor: pointer; }
.tf-primary:disabled { background: var(--bg-control); color: var(--text-muted); cursor: default; }
.tf-tool { width: var(--h-tool); height: var(--h-tool); border: 0; border-radius: var(--radius-m); background: none; color: var(--text-tool); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.tf-tool:hover { background: var(--bg-hover); }
.tf-tool.on { background: var(--accent); color: var(--on-accent); }
.tf-tool.sm { width: 30px; height: 30px; flex: none; }
.tf-btn .tf-ic { width: 16px; height: 16px; }

/* Rahmen */
.tf-rail { width: var(--w-rail); background: var(--bg-rail); display: flex; flex-direction: column; align-items: center; gap: var(--space-1); padding: 10px 0; }
.tf-mark { width: 32px; height: 32px; background: var(--accent); color: var(--on-accent); border-radius: var(--radius-l); font-weight: 600; display: flex; align-items: center; justify-content: center; margin-bottom: var(--space-3); }
.tf-mode { width: 60px; height: 52px; border: 0; border-radius: var(--radius-l); background: none; color: var(--text-muted); font: 500 11px/14px var(--font-sans); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer; }
.tf-mode.on { background: var(--bg-control); color: var(--accent); }
.tf-toolbar { height: var(--h-toolbar); display: flex; align-items: center; gap: 2px; padding: 0 10px; background: var(--bg-panel); border-bottom: 1px solid var(--line-strong); }
.tf-sep { width: 1px; height: 18px; background: var(--line-soft); margin: 0 6px; }
.tf-grow { flex: 1; }
.tf-sec { padding: 10px var(--space-3); border-bottom: 1px solid var(--line); background: var(--bg-panel); }
.tf-h { font: 500 13px/18px var(--font-sans); color: var(--text-muted); margin-bottom: 6px; padding-left: var(--space-2); display: flex; justify-content: space-between; gap: var(--space-2); }
.tf-outbar { height: var(--h-outbar); background: var(--bg-panel); border-top: 1px solid var(--line-strong); display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-3); }

/* Felder */
.tf-field { display: flex; flex-direction: column; gap: var(--space-1); font: 500 13px/18px var(--font-sans); color: var(--text-muted); padding-left: var(--space-2); }
.tf-field > .tf-in, .tf-field > .tf-sel, .tf-field > .tf-area { margin-left: calc(-1 * var(--space-2)); width: calc(100% + var(--space-2)); }
.tf-in, .tf-sel { box-sizing: border-box; height: var(--h-control); width: 100%; border: 1px solid transparent; border-radius: var(--radius-m); background: var(--bg-app); color: var(--text); font: 400 14px/20px var(--font-sans); padding: 0 var(--space-2); }
.tf-sel { background: var(--bg-control); }
.tf-in { padding-left: calc(var(--space-2) - 1px); } /* mit dem Rand zusammen genau space-2: Text und Beschriftung stehen auf einer Linie */
.tf-in.bad { border-color: var(--warn); }
.tf-in::placeholder { color: var(--text-muted); }
.tf-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.tf-check { accent-color: var(--accent); margin: 0; }
.tf-switch { display: inline-block; flex: none; width: 32px; height: 18px; border-radius: 9px; background: var(--switch-off); position: relative; border: 0; padding: 0; cursor: pointer; }
.tf-switch i { position: absolute; width: 14px; height: 14px; left: 2px; top: 2px; background: var(--text); border-radius: 50%; }
.tf-switch.on { background: var(--accent); }
.tf-switch.on i { left: 16px; background: var(--on-accent); }
.tf-seg { display: inline-flex; gap: 2px; background: var(--bg-app); border-radius: var(--radius-m); padding: 2px; }
.tf-seg button { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-1); border: 0; background: none; color: var(--text-muted); font: 500 14px/20px var(--font-sans); height: 26px; padding: 0 var(--space-2); border-radius: var(--radius-s); cursor: pointer; }
.tf-seg.full { display: flex; }
.tf-seg.full button { flex: 1; min-width: 0; }
.tf-seg .tf-ic { width: 16px; height: 16px; }
.tf-seg button.on { background: var(--bg-control); color: var(--text); }

/* Zeilen. Listen stehen in tf-rows: Zeilen mit Fläche kleben nie aneinander */
.tf-rows, .tf-menu { display: flex; flex-direction: column; gap: var(--space-1); }
.tf-rows > *, .tf-menu > * { flex: none; }
.tf-row { height: var(--h-control); display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-2); border-radius: var(--radius-s); color: var(--text-body); cursor: pointer; }
button.tf-row { width: 100%; border: 0; background: none; font: 400 14px/20px var(--font-sans); text-align: left; }
.tf-row:hover { background: var(--bg-hover); }
.tf-row.sel { background: var(--select-bg); color: var(--select-text); }
.tf-row .n { width: 14px; text-align: right; font: 400 13px/18px var(--font-mono); color: var(--text-muted); }
.tf-row.sel .n, .tf-row.sel .s { color: var(--select-text); }
.tf-row .s { margin-left: auto; flex: none; white-space: nowrap; color: var(--text-muted); font: 400 13px/18px var(--font-mono); }
.tf-row .k { width: 14px; font: 500 12px/16px var(--font-mono); color: var(--text-muted); }

/* Zustände */
.tf-flag { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--warn); font: 500 13px/18px var(--font-sans); }
.tf-flag b, .tf-gap { display: inline-block; width: 16px; height: 16px; border-radius: 50%; background: var(--warn-bg); color: var(--warn); font: 600 12px/16px var(--font-sans); text-align: center; }
.tf-ok { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.tf-none { display: inline-block; width: 8px; height: 8px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--text-muted); }
.tf-note { background: var(--warn-note-bg); color: var(--warn-note-text); border-radius: var(--radius-l); padding: var(--space-2); }
.tf-note strong { display: block; color: var(--warn); font-weight: 500; }
.tf-note.err { background: var(--danger-bg); color: var(--danger-text); }
.tf-note.info { background: var(--bg-card); color: var(--text-body); }

/* Flugliste */
.tf-table { border-collapse: collapse; width: 100%; background: var(--bg-app); }
.tf-table th { height: 32px; text-align: left; font: 500 13px/18px var(--font-sans); color: var(--text-muted); padding: 0 10px; border-bottom: 1px solid var(--line-strong); background: var(--bg-panel); }
.tf-table td { height: var(--h-row); padding: 0 10px; border-bottom: 1px solid var(--line-row); font: 400 14px/20px var(--font-mono); color: var(--text-body); }
.tf-table tr.view td { background: var(--view-bg); }

/* Bedingungen */
.tf-cond { background: var(--cond-bg); border: 1px solid var(--cond-line); border-radius: var(--radius-m); padding: 6px; display: flex; flex-direction: column; gap: 6px; }
.tf-cond.open { border-color: var(--warn); }
.tf-cond-h { display: grid; grid-template-columns: minmax(0, 1fr) 76px; gap: var(--space-1); }
.tf-chips { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.tf-chips:has(.chip-in) .tf-chip { box-sizing: border-box; height: var(--h-control); display: inline-flex; align-items: center; } /* Wert und Eingabe gleich hoch */
.tf-chip { display: inline-flex; height: 24px; align-items: center; gap: var(--space-1); padding: 0 6px; background: var(--data-bg); color: var(--data); border: 0; border-radius: var(--radius-s); font: 400 13px/18px var(--font-mono); }
.tf-and { text-align: center; color: var(--text-muted); font: 500 13px/18px var(--font-sans); }

/* Karten */
.tf-card { background: var(--bg-card); border-radius: var(--radius-l); }
.tf-card.on { box-shadow: 0 0 0 1px var(--accent); }
.tf-card-h { height: 34px; display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-2); }
.tf-card-b { padding: 0 var(--space-2) var(--space-2); display: flex; flex-direction: column; gap: 6px; }

/* Schwebend */
.tf-float { background: var(--bg-control); border-radius: var(--radius-xl); box-shadow: var(--shadow-float); }
.tf-menu { width: 260px; padding: var(--space-1); }
.tf-menu button { display: flex; width: 100%; height: var(--h-control); align-items: center; justify-content: space-between; border: 0; background: none; color: var(--text); font: 400 14px/20px var(--font-sans); border-radius: var(--radius-s); padding: 0 var(--space-2); cursor: pointer; }
.tf-menu button:hover { background: var(--bg-hover); }
.tf-menu button span { color: var(--text-muted); font: 400 13px/18px var(--font-mono); }
.tf-menu hr { border: 0; height: 1px; background: var(--line-soft); margin: 0; }
.tf-dialog { width: 460px; padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); }
.tf-dialog h3 { margin: 0; padding-left: var(--space-2); font: 600 17px/24px var(--font-sans); }
.tf-dialog p { margin: 0; padding-left: var(--space-2); color: var(--text-body); }
.tf-actions { display: flex; justify-content: flex-end; gap: var(--space-2); align-items: center; }
.tf-toast { display: inline-flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); }
.tf-toast button { border: 0; background: none; color: var(--accent); font: 500 14px/20px var(--font-sans); cursor: pointer; }

/* Zahlenfeld mit Pfeilen */
.tf-numf { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; padding-left: var(--space-2); font: 500 13px/18px var(--font-sans); color: var(--text-muted); }
.tf-unit { position: relative; display: block; margin-left: calc(-1 * var(--space-2)); }
.tf-unit .tf-in { padding-right: 46px; font: 400 14px/20px var(--font-mono); }
.tf-unit em { position: absolute; right: 22px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 12px; color: var(--text-muted); pointer-events: none; }
.tf-spin { position: absolute; right: 1px; top: 1px; bottom: 1px; width: 18px; display: flex; flex-direction: column; gap: 1px; }
.tf-spin button { flex: 1; min-height: 0; border: 0; padding: 0; background: var(--bg-control); color: var(--text-muted); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.tf-spin button:first-child { border-radius: var(--radius-s) var(--radius-s) 0 0; }
.tf-spin button:last-child { border-radius: 0 0 var(--radius-s) var(--radius-s); }
.tf-spin button:hover { background: var(--bg-hover); color: var(--text); }
.tf-spin button:active { background: var(--select-bg); color: var(--select-text); }
.tf-spin .tf-ic { width: 12px; height: 12px; }

/* Kopf des Inspectors */
.insp-h { padding: var(--space-3); border-bottom: 1px solid var(--line); background: var(--bg-panel); display: flex; flex-direction: column; gap: 6px; }
.insp-kind { display: flex; align-items: center; gap: var(--space-1); padding-left: var(--space-2); font: 500 13px/18px var(--font-sans); color: var(--text-muted); }
.insp-kind .tf-ic { width: 16px; height: 16px; }
.tree-add { background: none; color: var(--text-muted); text-align: left; }
.tree-add:hover, .tree-add:focus-visible { color: var(--text); }
.tf-saved { padding: 0 2px var(--space-1); text-align: center; font: 400 12px/14px var(--font-sans); color: var(--text-muted); }
.insp-title { font-weight: 500; }
.insp-h.row { flex-direction: row; align-items: center; gap: var(--space-2); }
.insp-ic { display: inline-flex; flex: none; margin-left: var(--space-2); color: var(--text-muted); }
.insp-ic .tf-ic { width: 18px; height: 18px; }
.fold-h { display: inline-flex; align-items: center; gap: var(--space-1); flex: 1; min-width: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.fold-h:hover { color: var(--text); }
.fold-h .tf-ic { width: 14px; height: 14px; }

/* Linienmuster */
.bp-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-1); }
.bp { height: 34px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: var(--radius-m); background: var(--bg-control); color: var(--text); cursor: pointer; padding: 0; }
.bp:hover { background: var(--bg-hover); }
.bp svg { display: block; }
.bp-full { stroke: currentColor; stroke-width: 1.6; }
.bp-soft { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 2 2; }
.bp-ink { fill: none; stroke: currentColor; stroke-width: 1.8; }
.bp-none { fill: none; stroke: var(--danger); stroke-width: 1.6; }

/* Zelle der Flugliste */
.tf-cell { width: 100%; min-width: 3ch; box-sizing: border-box; height: 28px; border: 0; border-radius: var(--radius-s); background: none; color: inherit; font: inherit; padding: 0 var(--space-1); margin: 0 calc(-1 * var(--space-1)); }
.tf-cell:hover:not([readonly]) { background: var(--bg-control); }
.tf-cell:focus { background: var(--bg-app); color: var(--text); outline: 2px solid var(--accent); outline-offset: 0; }
.tf-cell.edit, .tf-cell.edit:hover:not([readonly]) { background: var(--select-bg); color: var(--select-text); }
.tf-cell[readonly] { cursor: default; }

/* Mehrzeiliges Feld */
.tf-area { box-sizing: border-box; width: 100%; min-height: 58px; resize: vertical; border: 1px solid transparent; border-radius: var(--radius-m); background: var(--bg-app); color: var(--text); font: 400 14px/20px var(--font-sans); padding: 6px var(--space-2); }
.tf-area.bad { border-color: var(--warn); }
.tf-area::placeholder { color: var(--text-muted); }

/* Dialog */
.tf-backdrop { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: var(--backdrop); }
.tf-choice { display: flex; flex-direction: column; gap: var(--space-1); }
.tf-choice label { display: flex; gap: var(--space-2); align-items: flex-start; padding: var(--space-2); border-radius: var(--radius-m); background: var(--bg-panel); cursor: pointer; }
.tf-choice input { accent-color: var(--accent); margin: 2px 0 0; }
.tf-choice b { display: block; font: 500 14px/20px var(--font-sans); }
.tf-choice small { display: block; color: var(--text-muted); font: 400 13px/18px var(--font-sans); }

/* Zeile ziehen */
.tf-sort-ghost { position: fixed; z-index: 100; margin: 0; pointer-events: none; background: var(--bg-control); color: var(--text); border-radius: var(--radius-m); box-shadow: var(--shadow-float); }
.tf-sort-hole { visibility: hidden; }
body.is-sorting, body.is-sorting * { cursor: grabbing !important; user-select: none; }

/* Leerzustand */
.tf-empty .btn-row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--space-2); }
.tf-empty .btn-row > button, .tf-actions > .tf-btn, .tf-outbar > .tf-btn { height: var(--h-primary); border-radius: var(--radius-l); font: 600 15px/20px var(--font-sans); padding: 0 16px; white-space: nowrap; }
.tf-empty { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); padding: var(--space-5); color: var(--text-muted); text-align: center; }

/* Wahlzeile im Menü */
.tf-menu .tf-h { padding: var(--space-1) var(--space-2) 0; margin: 0; }
.tf-pick { display: flex; height: var(--h-control); align-items: center; gap: var(--space-2); padding: 0 var(--space-2); border-radius: var(--radius-s); color: var(--text); cursor: pointer; }
.tf-pick:hover { background: var(--bg-hover); }

/* Sprache */
.tf-lang { display: flex; flex-direction: column; gap: 2px; }
.tf-lang button { width: 40px; height: 26px; border: 0; border-radius: var(--radius-s); background: none; color: var(--text-muted); font: 500 13px/18px var(--font-mono); cursor: pointer; }
.tf-lang button:hover { background: var(--bg-hover); }
.tf-lang button.on { background: var(--bg-control); color: var(--text); }

/* Hilfe */
.tf-tip { display: inline-flex; align-items: center; gap: var(--space-2); background: var(--select-bg); color: var(--select-text); border-radius: var(--radius-l); box-shadow: var(--shadow-float); padding: var(--space-1) var(--space-2); }
.tf-tip kbd { font: 400 13px/18px var(--font-mono); color: var(--tip-text); background: var(--tip-kbd-bg); border-radius: var(--radius-s); padding: 0 5px; }
.tf-q { width: 18px; height: 18px; flex: none; border: 0; padding: 0; border-radius: 50%; background: var(--bg-control); color: var(--text-muted); font: 600 12px/16px var(--font-sans); text-align: center; cursor: pointer; }
.tf-q:hover, .tf-q.on { background: var(--bg-hover); color: var(--text); }
.tf-helptip { width: 300px; padding: var(--space-3); display: flex; flex-direction: column; gap: 6px; }
.tf-helptip b { font: 600 14px/20px var(--font-sans); }
.tf-helptip p { margin: 0; color: var(--text-body); }
.tf-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; background: none; border: 0; padding: 0; font: 500 14px/20px var(--font-sans); cursor: pointer; text-align: left; }
.tf-manual { display: grid; grid-template-columns: 260px minmax(0, 1fr) 200px; background: var(--bg-app); min-height: 440px; }
.tf-manual nav { background: var(--bg-panel); border-right: 1px solid var(--line-strong); padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-1); }
.tf-manual article { padding: var(--space-5); max-width: 680px; }
.tf-manual aside { padding: var(--space-5) var(--space-3); display: flex; flex-direction: column; gap: var(--space-1); }
.tf-manual h1 { margin: 0 0 var(--space-3); font: 600 22px/28px var(--font-sans); }
.tf-manual h2 { margin: var(--space-5) 0 var(--space-2); font: 600 17px/24px var(--font-sans); }
.tf-manual p, .tf-manual li { font: 400 15px/20px var(--font-sans); color: var(--text-body); }
.tf-manual p { margin: 0 0 var(--space-3); }
.tf-manual ol { margin: 0 0 var(--space-3); padding-left: var(--space-5); }
.tf-manual .kbd { font: 400 13px/18px var(--font-mono); background: var(--bg-control); border-radius: var(--radius-s); padding: 1px 4px; color: var(--text); }
