/* Text-Werkzeuge: Zeichenzähler, Wortzähler, Zeilen sortieren, Texteditor */
.tx-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 8.2rem), 1fr)); gap: 0.45rem; }
.tx-stats > div { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.55rem 0.7rem; border-radius: var(--r-s); background: var(--accent-soft); min-width: 0; }
.tx-stats b { font-size: 1.15rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tx-stats span { font-size: 0.78rem; color: var(--muted); }
.tx-stats > .is-main { background: var(--accent); color: var(--accent-ink); }
.tx-stats > .is-main span { color: inherit; opacity: 0.85; }
.tx-stats > .is-warn { background: var(--warn-soft); }
.tx-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 0.7rem 1rem; align-items: end; }
.tx-opt { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.88rem; font-weight: 500; }
.tx-opt select { padding: 0.2rem 0.4rem; min-height: 0; font-size: 0.88rem; }

/* Balken */
.tx-bar { height: 0.7rem; background: var(--line); border-radius: 99px; overflow: hidden; }
.tx-bar > span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width 0.15s; }
.tx-bar > span.is-near { background: var(--signal); }
.tx-bar > span.is-over { background: var(--bad); }
.tx-bar > span.is-done { background: var(--ok); }

/* Zeichenzähler: Grenzen */
.tx-own { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.8rem; }
.tx-own label { font-weight: 600; font-size: 0.92rem; }
.tx-own input { max-width: 10rem; }
.tx-limits { display: grid; gap: 0.15rem; }
.tx-limit { display: grid; grid-template-columns: minmax(10rem, 17rem) minmax(5rem, 1fr) minmax(10rem, 15rem); gap: 0.4rem 0.9rem; align-items: center; padding: 0.4rem 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.tx-limit:last-child { border-bottom: 0; }
.tx-limit-v { font-variant-numeric: tabular-nums; color: var(--muted); }
.tx-limit.is-over .tx-limit-v { color: var(--bad); font-weight: 600; }
@media (max-width: 640px) {
  .tx-limit { grid-template-columns: 1fr auto; }
  .tx-limit .tx-bar { grid-column: 1 / -1; grid-row: 2; }
}

/* Wortzähler */
.tx-goal { display: grid; grid-template-columns: minmax(10rem, 13rem) 1fr; gap: 0.5rem 1rem; align-items: end; }
.tx-goal-bar { display: grid; gap: 0.3rem; padding-bottom: 0.35rem; }
.tx-goal-bar .tx-bar { height: 0.9rem; }
@media (max-width: 560px) { .tx-goal { grid-template-columns: 1fr; } }
.tx-top-h { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.4rem 1rem; }
.tx-top { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.35rem; counter-reset: tx; }
.tx-top li { display: grid; grid-template-columns: 1.6rem minmax(6rem, 12rem) 1fr 7.5rem; gap: 0.6rem; align-items: center; font-size: 0.9rem; counter-increment: tx; }
.tx-top li::before { content: counter(tx) "."; color: var(--muted); text-align: right; }
.tx-top-w { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-top-n { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
@media (max-width: 560px) { .tx-top li { grid-template-columns: 1.4rem 1fr 6.5rem; } .tx-top li .tx-bar { display: none; } }

/* Zeilen sortieren */
.tx-two { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.tx-two textarea { font-family: var(--mono); font-size: 0.9rem; min-height: 14rem; }
@media (max-width: 720px) { .tx-two { grid-template-columns: 1fr; } }

/* Texteditor */
.tx-editor { display: flex; flex-direction: column; }
.tx-toolbar, .tx-find, .tx-status { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.6rem; }
.tx-sep { flex: 1 1 auto; }
.tx-find { padding: 0.55rem 0.6rem; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--accent-soft); }
.tx-find input[type="text"] { flex: 1 1 11rem; min-width: 0; padding: 0.35rem 0.55rem; min-height: 0; }
.tx-frame { display: flex; height: min(70vh, 40rem); min-height: 18rem; border: 2px solid var(--line); border-radius: var(--r-s); background: var(--card); overflow: hidden; }
.tx-frame.is-over { border-color: var(--accent); background: var(--accent-soft); }
.tx-frame:focus-within { border-color: var(--accent); }
.tx-gutter { margin: 0; padding: 0.6rem 0.5rem 0.6rem 0.4rem; min-width: 3.2rem; text-align: right; overflow: hidden; color: var(--muted); background: var(--paper); border-right: 1px solid var(--line); font-family: var(--mono); line-height: 1.5; user-select: none; white-space: pre; }
.tx-editor.is-wrap .tx-gutter { display: none; }
#te-text { flex: 1 1 auto; width: 100%; height: 100%; margin: 0; padding: 0.6rem 0.75rem; border: 0; border-radius: 0; resize: none; outline: none; background: transparent; color: var(--ink); font-family: var(--mono); line-height: 1.5; tab-size: 4; white-space: pre; overflow: auto; box-shadow: none; }
.tx-editor.is-wrap #te-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.tx-status { font-size: 0.82rem; color: var(--muted); }
.tx-status > span { font-variant-numeric: tabular-nums; }
.tx-status > span:first-child { font-weight: 700; color: var(--ink); margin-right: auto; overflow-wrap: anywhere; }
