/* xClaude – Schaltzentrale für parallele KI-Sitzungen.
   Erkennungszeichen: jede Konto-Nummer hat eine feste Farbe (--acct), die sich durch Anzeige, Sitzungsliste
   und Kopfzeile zieht. Alles andere bleibt ruhig. */

:root {
  --ink: #11151c;
  --panel: #171c24;
  --raise: #1e2530;
  --rule: #2a323e;
  --text: #d8dee6;
  --muted: #7d8896;
  --faint: #4a5462;
  --clay: #d97757;
  --wait: #5fb3a1;
  --work: #e0b15a;
  --bad: #e5736b;

  --ui: "Segoe UI Variable Text", "Segoe UI", -apple-system, "SF Pro Text", system-ui, sans-serif;
  --mono: "Cascadia Code", "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;

  --side: 284px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: var(--text); font: 13.5px/1.45 var(--ui); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--clay); outline-offset: 2px; }
[hidden] { display: none !important; }

/* Schmale, dunkle Scrollleisten statt der hellen Systemleisten */
* { scrollbar-width: thin; scrollbar-color: var(--faint) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--faint); }
::-webkit-scrollbar-corner { background: transparent; }

.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); height: 100dvh; overflow: hidden; }

/* ── Seitenleiste ── */
.side { position: relative; display: flex; flex-direction: column; background: var(--panel); border-right: 1px solid var(--rule); min-height: 0; min-width: 0; }
.side-head { padding: 16px 18px 10px; }
.brand { font-weight: 650; font-size: 16px; letter-spacing: .01em; }

/* Breite der Seitenleiste ziehen; die Linie zeigt sich erst beim Überfahren */
.side-resize { position: absolute; top: 0; right: -4px; bottom: 0; width: 8px; cursor: col-resize; z-index: 3; touch-action: none; }
.side-resize::after { content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px; background: transparent; transition: background .15s; }
.side-resize:hover::after, .side-resize:focus-visible::after, .app.resizing .side-resize::after { background: var(--clay); }
.side-resize:focus-visible { outline: none; }
.app.resizing { cursor: col-resize; user-select: none; }
.app.resizing .stage { pointer-events: none; }
.brand-mark { color: var(--clay); margin-right: 2px; }
.host { color: var(--muted); font: 11px/1.4 var(--mono); margin-top: 2px; }

.btn-new { margin: 6px 14px 12px; padding: 8px 12px; border: 1px dashed var(--faint); background: transparent; border-radius: 8px; text-align: left; cursor: pointer; color: var(--text); }
.btn-new:hover { border-color: var(--clay); color: #fff; }
.btn-new span { color: var(--clay); margin-right: 6px; }

.side-sec { padding: 0 8px 10px; min-height: 0; }
.side-sessions { flex: 1 1 auto; overflow: auto; }

/* Konten-Dock über dem Profil-Knopf: Ringe je Konto, aufklappbar zur ausführlichen Liste */
.dock { flex: 0 0 auto; border-top: 1px solid var(--rule); display: flex; flex-direction: column; min-height: 0; max-height: 55%; }
.dock-list { overflow: auto; padding: 0 8px 4px; min-height: 0; animation: menu-in .14s ease-out; }
.dock-list .eyebrow { position: sticky; top: 0; z-index: 1; background: var(--panel); margin: 0; padding: 10px 10px 8px; }
.dock-bar { display: flex; align-items: center; gap: 4px; padding: 6px 8px 6px 12px; }
.rings { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; flex: 1; min-width: 0; }
.ring { position: relative; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; cursor: pointer; }
.ring:hover { background: var(--raise); }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring .track { fill: none; stroke: var(--rule); stroke-width: 3; }
.ring .arc { fill: none; stroke: var(--lvl); stroke-width: 3; stroke-linecap: round; transition: stroke-dasharray .4s; }
.ring b { position: relative; font: 600 10px var(--mono); color: var(--acct); }
.acct-opt .ring { width: 30px; height: 30px; }
.acct-opt .ring b { font-size: 11px; }
.ring.off { opacity: .45; }
.ring.off .track { stroke-dasharray: 2 3; }
.ring.active::after { content: ""; position: absolute; bottom: -3px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--text); }
.dock-toggle { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid transparent; border-radius: 7px; background: transparent; cursor: pointer; }
.dock-toggle:hover { border-color: var(--rule); background: var(--raise); }
.dock-toggle .chev { width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-top: 1.5px solid var(--muted); transform: translateY(2px) rotate(-45deg); transition: transform .15s; }
.dock-toggle[aria-expanded="true"] .chev { transform: translateY(-2px) rotate(135deg); }

/* Kontenzeilen in den Einstellungen: Verbrauch unter der Adresse, Knöpfe in festen Spalten */
.list.acc-rows li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 10px 12px; }
.acc-info { min-width: 0; display: grid; gap: 6px; }
.acc-info .acc-mail { display: flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; }
.acc-label { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.acc-tags { margin-left: auto; display: flex; gap: 6px; flex: 0 0 auto; }
.chip.prim { color: var(--acct); border-color: color-mix(in srgb, var(--acct) 45%, var(--rule)); }
.acc-short { width: 64px !important; height: 26px; padding: 2px 8px !important; font: 600 12px var(--mono) !important; text-transform: uppercase; color: var(--acct); flex: 0 0 auto; }
.acc-usage { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; max-width: 620px; }
.acc-usage > div { display: grid; gap: 3px; }
.acc-usage .gauge { grid-template-columns: minmax(0, 1fr) 4.5ch; }
.acc-usage small { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acts { display: flex; gap: 2px; align-self: start; }
.acts .icon-btn:disabled { opacity: .3; cursor: default; background: transparent; border-color: transparent; }
.side-sec .eyebrow { position: sticky; top: 0; z-index: 1; background: var(--panel); margin: 0; padding: 8px 10px; }
.eyebrow { font: 600 10.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 6px 10px 8px; }
.eyebrow-hint { text-transform: none; letter-spacing: 0; color: var(--faint); font-weight: 400; margin-left: 6px; }

.sessions, .meters, .recent { list-style: none; margin: 0; padding: 0; }

.sess { position: relative; display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 7px 10px 7px 12px; border-radius: 7px; cursor: pointer; }
.sess::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 3px; border-radius: 2px; background: var(--acct, var(--faint)); }
.sess:hover { background: var(--raise); }
.sess.on { background: var(--raise); box-shadow: 0 0 0 1px var(--rule) inset; }
.sess-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.sess.on .sess-name { font-weight: 600; }
.sess-sub { grid-column: 2 / 4; display: flex; gap: 8px; color: var(--muted); font: 11px var(--mono); margin-top: -2px; min-width: 0; }
.sess-dir { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sess-meta { flex: 0 0 auto; color: var(--faint); white-space: nowrap; }
.sess:hover .sess-meta, .sess.on .sess-meta { color: var(--muted); }
.sess-name input { width: 100%; height: 24px; padding: 2px 6px; font-size: 13px; }
.sess[draggable="true"] { cursor: grab; }
.sess.dragging { opacity: .4; }
.sess.drop-before { box-shadow: 0 -2px 0 var(--clay); }
.sess.drop-after { box-shadow: 0 2px 0 var(--clay); }
.sess-more { position: absolute; right: 6px; top: 6px; width: 22px; height: 22px; border: 0; border-radius: 5px; background: var(--panel); color: var(--muted); cursor: pointer; opacity: 0; font-size: 14px; line-height: 1; }
.sess:hover .sess-more, .sess-more:focus-visible { opacity: 1; }
.sess-more:hover { color: var(--text); background: var(--rule); }
.menu.ctx { position: fixed; left: 0; top: 0; right: auto; bottom: auto; width: 220px; }
.menu button.danger { color: var(--bad); }
.menu-sec { padding: 8px 10px 4px; border-top: 1px solid var(--rule); margin-top: 4px; color: var(--muted); font: 600 10px var(--mono); text-transform: uppercase; letter-spacing: .1em; }
.menu-acct { display: flex; gap: 8px; min-width: 0; align-items: baseline; }
.menu-acct b { color: var(--acct); font: 600 11px var(--mono); flex: 0 0 auto; }
.menu-acct span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu.ctx { width: 260px; }
.sess-acct { font: 600 11px var(--mono); color: var(--acct); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.dot.busy { background: var(--work); box-shadow: 0 0 0 3px color-mix(in srgb, var(--work) 22%, transparent); animation: pulse 1.6s ease-in-out infinite; }
.dot.idle { background: var(--wait); }
.dot.exited { background: transparent; border: 1px solid var(--faint); }
@keyframes pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .dot.busy { animation: none; } }
.side-empty { color: var(--faint); font-size: 12.5px; padding: 2px 12px 6px; }

/* Konto-Anzeige: zwei liegende Pegel je Konto */
.meter { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 4px 8px; padding: 6px 10px; border-radius: 7px; }
.meter:hover { background: var(--raise); }
.meter-num { grid-row: 1 / 3; align-self: center; font: 600 13px var(--mono); color: var(--acct); text-align: center; }
.meter-label { display: flex; justify-content: space-between; gap: 6px; font-size: 12.5px; min-width: 0; }
.meter-label span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter-tag { color: var(--muted); font-size: 11px; white-space: nowrap; }
.meter-tag.prim { color: var(--acct); }
.gauges { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gauge { display: grid; grid-template-columns: minmax(0, 1fr) 3.2ch; align-items: center; gap: 6px; }
.gauge b { height: 6px; background: var(--rule); border-radius: 3px; overflow: hidden; position: relative; }
.gauge i { position: absolute; inset: 0 auto 0 0; background: var(--acct); border-radius: 3px; }
.gauge em { font: 10.5px var(--mono); font-style: normal; color: var(--muted); text-align: right; }
.gauge.hot i { background: var(--work); }
.gauge.hot em { color: var(--work); }
.gauge.full i { background: var(--bad); }
.gauge.full em { color: var(--bad); }
.meter.off { opacity: .45; }
.meter-note { grid-column: 2; color: var(--muted); font-size: 11px; }

.side-foot { position: relative; flex: 0 0 auto; padding: 6px 8px; border-top: 1px solid var(--rule); }

/* Profil-Knopf unten links mit Menü, angelehnt an Claude Desktop */
.me { width: 100%; display: grid; grid-template-columns: 26px minmax(0, 1fr) 14px; align-items: center; gap: 9px; padding: 4px 8px; border: 1px solid transparent; border-radius: 9px; background: transparent; cursor: pointer; text-align: left; }
.me:hover, .me[aria-expanded="true"] { background: var(--raise); border-color: var(--rule); }
.me-avatar { position: relative; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--clay) 22%, var(--raise)); color: var(--clay); font: 600 12px var(--ui); text-transform: uppercase; }
.me-avatar.upd::after { content: ""; position: absolute; top: -1px; right: -1px; width: 10px; height: 10px; border-radius: 50%; background: var(--work); border: 2px solid var(--panel); }
.me-text { display: grid; min-width: 0; line-height: 1.25; }
.me-name { font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-sub { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-chev { width: 8px; height: 8px; border-right: 1.5px solid var(--muted); border-top: 1.5px solid var(--muted); transform: rotate(-45deg) translate(-1px, 2px); justify-self: center; }

.menu { position: absolute; left: 8px; right: 8px; bottom: calc(100% - 2px); z-index: 20; padding: 6px; border: 1px solid var(--rule); border-radius: 11px; background: var(--raise); box-shadow: 0 14px 40px rgb(0 0 0 / .45); display: grid; gap: 1px; animation: menu-in .12s ease-out; }
@keyframes menu-in { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .menu { animation: none; } }
.menu-head { padding: 6px 10px 8px; border-bottom: 1px solid var(--rule); margin-bottom: 4px; display: grid; }
.menu-head b { font-weight: 600; font-size: 13px; }
.menu-head span { color: var(--muted); font: 11px var(--mono); }
.menu button { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 7px 10px; border: 0; border-radius: 7px; background: transparent; cursor: pointer; text-align: left; font-size: 13px; }
.menu button:hover, .menu button:focus-visible { background: color-mix(in srgb, var(--text) 8%, transparent); outline: none; }
.menu button small { color: var(--muted); font: 11px var(--mono); }
.menu button.accent { color: var(--work); }
.menu hr { border: 0; border-top: 1px solid var(--rule); margin: 4px 2px; }
.upd { flex: 0 0 auto; margin: 0 12px 12px; padding: 10px 12px; border: 1px solid var(--rule); border-left: 3px solid var(--clay); border-radius: 8px; background: var(--raise); display: grid; gap: 6px; }
.upd-title { font-weight: 600; }
.upd-title span { color: var(--clay); font-family: var(--mono); font-weight: 500; }
.upd-text { color: var(--muted); font-size: 12px; }
.upd .btn-primary { justify-self: start; padding: 6px 12px; }
.upd .btn-primary[disabled] { opacity: .6; cursor: progress; }

/* ── Integrierter Fensterkopf (Desktop-App ohne Systemrahmen) ──
   Kopfzeile und Seitenleisten-Kopf ziehen das Fenster, Bedienelemente darin nicht. */
.framed .topbar, .framed .side-head { --wails-draggable: drag; user-select: none; }
.framed .topbar button, .framed .topbar input, .framed .topbar select, .framed .topbar .acct-pick, .framed .topbar .acct-menu,
.framed .side-head button { --wails-draggable: no-drag; }
.win-ctl { display: flex; align-self: stretch; margin: -8px -14px -8px 6px; }
.win-ctl button { width: 46px; border: 0; background: transparent; color: var(--muted); cursor: default; display: grid; place-items: center; }
.win-ctl button:hover { background: color-mix(in srgb, var(--text) 9%, transparent); color: var(--text); }
.win-ctl .win-close:hover { background: #c42b1c; color: #fff; }
.win-ctl svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 1; }
.mac-inset .side-head { padding-top: 34px; }

/* ── Hauptbereich ── */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-bottom: 1px solid var(--rule); border-top: 3px solid var(--acct, transparent); background: var(--panel); min-height: 52px; }
.top-title { min-width: 0; flex: 1; }
.top-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-dir { color: var(--muted); font: 11.5px var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 8px; }
/* Kontoauswahl der Sitzung: eigenes Menü, damit je Konto alle Kontingente auf einen Blick sichtbar sind */
.acct-pick { position: relative; min-width: 0; }
.acct-btn { display: flex; align-items: center; gap: 8px; height: 32px; max-width: min(460px, 46vw); padding: 0 10px; border: 1px solid var(--rule); border-radius: 7px; background: var(--ink); cursor: pointer; font-size: 12.5px; }
.acct-btn:hover, .acct-btn[aria-expanded="true"] { border-color: var(--muted); }
.acct-btn-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.acct-btn-use { color: var(--muted); font: 11px var(--mono); white-space: nowrap; }
.acct-btn .chev, .acct-pick .chev { width: 7px; height: 7px; flex: 0 0 auto; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: translateY(-2px) rotate(45deg); margin-left: 2px; }
.acct-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: min(520px, calc(100vw - 24px)); max-height: min(70dvh, 560px); overflow: auto; padding: 6px; border: 1px solid var(--rule); border-radius: 11px; background: var(--raise); box-shadow: 0 14px 40px rgb(0 0 0 / .45); animation: menu-in .12s ease-out; }
.acct-opt { display: grid; grid-template-columns: 30px minmax(0, 1fr) 16px; gap: 6px 12px; align-items: center; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; }
.acct-opt:hover, .acct-opt:focus-visible { background: color-mix(in srgb, var(--text) 7%, transparent); outline: none; }
.acct-opt.cur { background: color-mix(in srgb, var(--acct) 12%, transparent); }
.acct-opt .ring { cursor: inherit; grid-row: 1 / 3; }
.acct-opt-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 13px; }
.acct-opt-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-opt-head small { color: var(--muted); font-size: 11px; white-space: nowrap; }
.acct-opt-head .rec { color: var(--wait); }
.acct-opt-lims { grid-column: 2; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.acct-opt-lims > div { display: grid; gap: 2px; min-width: 0; }
.acct-opt-lims small { color: var(--muted); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-opt-lims .gauge { grid-template-columns: minmax(0, 1fr) 4.5ch; }
.acct-hint { padding: 8px 10px 4px; border-top: 1px solid var(--rule); margin-top: 4px; color: var(--muted); font-size: 11px; }
.acct-opt .check { grid-row: 1 / 3; grid-column: 3; color: var(--acct); font-weight: 700; }

/* Gruppen je Rechner in der Sitzungsliste */
.host-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 10px 10px 4px; font: 600 11px var(--mono); color: var(--text); letter-spacing: .02em; }
.host-head small { color: var(--muted); font-weight: 400; }
.host-head.off { opacity: .5; }
.host-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.host-opt { padding: 6px 12px; border: 1px solid var(--rule); border-radius: 99px; background: var(--ink); cursor: pointer; font-size: 12.5px; }
.host-opt.on { border-color: var(--clay); color: #fff; box-shadow: 0 0 0 1px var(--clay) inset; }

/* Anmeldung im Browser */
.login { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: var(--ink); }
.login-box { width: min(380px, 100%); display: grid; gap: 14px; padding: 28px 26px; border: 1px solid var(--rule); border-radius: 14px; background: var(--panel); }
.login-box .brand { font-size: 20px; }
.login-box .btn-primary { width: 100%; }
.acct-card { display: grid; gap: 6px; padding: 14px 16px; border: 1px solid var(--rule); border-radius: 10px; background: var(--ink); }
.acct-card b { font-size: 15px; }
.acct-card a { color: var(--clay); }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 6px 14px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--raise); color: var(--text); }

/* Katalog bekannter MCP-Server */
.mcp-cat { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.mcp-card { text-align: left; display: grid; gap: 3px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 9px; background: var(--ink); cursor: pointer; }
.mcp-card:hover:not(:disabled) { border-color: var(--clay); }
.mcp-card b { font-weight: 600; font-size: 13px; }
.mcp-card span { color: var(--muted); font-size: 12px; }
.mcp-card small { color: var(--clay); font-size: 11px; margin-top: 2px; }
.mcp-card.on { opacity: .6; cursor: default; }
.mcp-card.on small { color: var(--wait); }

/* Sitzungssuche in der Seitenleiste */
.side-search { padding: 0 6px 8px; }
.side-search input { height: 30px; padding: 4px 10px; font-size: 12.5px; background: var(--ink); }
.past-box { margin-top: 6px; border-top: 1px solid var(--rule); }
.past-box .eyebrow { position: static; padding: 10px 10px 6px; }
.past-list { list-style: none; margin: 0; padding: 0; }
.past { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 8px; padding: 6px 10px; border-radius: 7px; cursor: pointer; }
.past:hover { background: var(--raise); }
.past.missing { opacity: .45; cursor: not-allowed; }
.past-title { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.past-title .star { color: var(--clay); }
.past-when { color: var(--muted); font-size: 11px; }
.past-dir { grid-column: 1 / 3; color: var(--muted); font: 11px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.acct-switch { display: flex; align-items: center; gap: 6px; height: 32px; border: 1px solid var(--rule); border-radius: 7px; padding: 0 4px 0 10px; background: var(--ink); min-width: 0; }
.acct-switch:hover { border-color: var(--muted); }
.acct-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--acct, var(--faint)); }
.acct-switch select { background: transparent; border: 0; padding: 3px 4px; max-width: min(400px, 40vw); cursor: pointer; font-size: 12.5px; text-overflow: ellipsis; }
.acct-switch select:focus { outline: none; }
.acct-switch select option { background: var(--panel); }
.icon-btn { background: transparent; border: 1px solid transparent; border-radius: 7px; width: 32px; height: 32px; cursor: pointer; color: var(--muted); display: inline-grid; place-items: center; }
.icon-btn:hover { border-color: var(--rule); background: var(--raise); color: var(--text); }
.menu-btn { display: none; }

.stage { position: relative; flex: 1; min-height: 0; background: var(--ink); }
.term { position: absolute; inset: 0; padding: 8px 2px 4px 12px; visibility: hidden; overflow: hidden; }
.term.on { visibility: visible; }
.term .xterm { height: 100%; }
.term .xterm-viewport { scrollbar-width: thin; scrollbar-color: var(--rule) transparent; background: transparent !important; }
.term.drop::after { content: "Dateien loslassen – Pfade werden eingefügt"; position: absolute; inset: 10px; border: 2px dashed var(--clay); border-radius: 10px; display: grid; place-items: center; color: var(--clay); background: color-mix(in srgb, var(--ink) 80%, transparent); }
.term-exit { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); background: var(--raise); border: 1px solid var(--rule); border-radius: 8px; padding: 8px 14px; color: var(--muted); }

.empty { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 6px; padding: 24px; }
.empty-title { font-size: 18px; margin: 0; }
.empty-text { color: var(--muted); max-width: 420px; margin: 0 0 12px; }

/* ── Bedienelemente ── */
.btn, .btn-primary { border-radius: 7px; padding: 7px 14px; min-height: 32px; cursor: pointer; border: 1px solid var(--rule); background: var(--raise); }
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--clay); border-color: var(--clay); color: #1b0f0a; font-weight: 600; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: .5; cursor: default; }
.btn-danger { border-color: color-mix(in srgb, var(--bad) 50%, var(--rule)); color: var(--bad); background: transparent; }
input[type=text], input[type=search], input[type=password], input[type=url], input[type=email], textarea, select.field {
  width: 100%; background: var(--ink); border: 1px solid var(--rule); border-radius: 7px; padding: 8px 10px; }
input:focus, textarea:focus { border-color: var(--clay); outline: none; }
.row { display: flex; gap: 8px; }
.row > input { flex: 1; }

/* ── Dialoge ── */
.dlg { border: 1px solid var(--rule); border-radius: 12px; background: var(--panel); color: var(--text); padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); }
.dlg-wide { width: min(860px, calc(100vw - 24px)); }

/* Einstellungen: Bereiche links, Inhalt rechts */
.dlg-settings { width: min(980px, calc(100vw - 24px)); height: min(680px, calc(100dvh - 32px)); }
.settings { display: grid; grid-template-columns: 200px minmax(0, 1fr); height: 100%; }
.set-nav { display: flex; flex-direction: column; gap: 2px; padding: 18px 10px; border-right: 1px solid var(--rule); background: color-mix(in srgb, var(--ink) 45%, var(--panel)); overflow: auto; }
.set-title { font-size: 15px; font-weight: 650; margin: 0 8px 12px; }
.set-nav button { text-align: left; padding: 7px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; }
.set-nav button:hover { color: var(--text); background: var(--raise); }
.set-nav button.on { color: var(--text); background: var(--raise); box-shadow: 2px 0 0 var(--clay) inset; font-weight: 600; }
.set-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.set-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 10px 24px; border-bottom: 1px solid var(--rule); }
.set-head h3 { margin: 0; font-size: 16px; font-weight: 650; }
.set-main .tab-body { flex: 1; overflow: auto; padding: 16px 24px 24px; min-height: 0; }
.about { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.about dt { color: var(--muted); }
.about dd { margin: 0; font-family: var(--mono); font-size: 12.5px; }
.dlg::backdrop { background: rgb(5 7 10 / .66); }
.dlg-body { padding: 16px 20px 18px; display: flex; flex-direction: column; gap: 8px; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.dlg-head h2 { margin: 0; font-size: 17px; font-weight: 650; }
.dlg h3.eyebrow { margin: 12px 0 4px; }
.dlg-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.dlg-note { color: var(--muted); font-size: 12.5px; }
.dlg-error { color: var(--bad); margin: 6px 0 0; }

.profiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.prof { text-align: left; border: 1px solid var(--rule); border-left: 3px solid var(--acct); border-radius: 8px; padding: 8px 10px; background: var(--ink); cursor: pointer; display: grid; gap: 5px; }
.prof:hover { border-color: var(--muted); border-left-color: var(--acct); }
.prof.on { border-color: var(--acct); box-shadow: 0 0 0 1px var(--acct) inset; }
.prof.dis { opacity: .45; cursor: not-allowed; }
.prof-top { display: flex; justify-content: space-between; gap: 6px; font-size: 13px; }
.prof-top b { font: 600 12px var(--mono); color: var(--acct); }
.prof-top span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prof-sub { color: var(--muted); font-size: 11.5px; }
.prof-rec { color: var(--wait); font-size: 11px; }

.recent { max-height: 220px; overflow: auto; border: 1px solid var(--rule); border-radius: 8px; }
.recent li { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; padding: 7px 10px; cursor: pointer; border-bottom: 1px solid var(--rule); }
.recent li:last-child { border-bottom: 0; }
.recent li:hover, .recent li.on { background: var(--raise); }
.recent li.on { box-shadow: 3px 0 0 var(--clay) inset; }
.recent .r-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent .r-when { color: var(--muted); font-size: 11.5px; }
.recent .r-dir { grid-column: 1 / 3; color: var(--muted); font: 11px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent .star { color: var(--clay); margin-right: 4px; }
.recent li.missing { opacity: .45; cursor: not-allowed; }
.recent-empty { color: var(--faint); padding: 10px; cursor: default !important; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--rule); margin-bottom: 8px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 8px 12px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--text); border-bottom-color: var(--clay); }
.tab-body { display: flex; flex-direction: column; gap: 10px; min-height: 280px; }
.lead { color: var(--muted); margin: 0; }
.list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--rule); border-radius: 8px; }
.list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--rule); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .sub { color: var(--muted); font-size: 12px; }
.num { font: 600 12px var(--mono); color: var(--acct); width: 22px; text-align: center; }
.chip { font-size: 11px; border: 1px solid var(--rule); border-radius: 99px; padding: 1px 8px; color: var(--muted); white-space: nowrap; }
.chip.ok { color: var(--wait); border-color: color-mix(in srgb, var(--wait) 45%, var(--rule)); }
.choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.choice button { text-align: left; border: 1px solid var(--rule); background: var(--ink); border-radius: 9px; padding: 12px; cursor: pointer; display: grid; gap: 4px; }
.choice button:hover, .choice button.on { border-color: var(--clay); }
.choice b { font-weight: 600; }
.choice span { color: var(--muted); font-size: 12.5px; }
.form { display: grid; gap: 8px; }
.form label, label.form { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); }
.mini { padding: 3px 10px; font-size: 12px; min-height: 28px; }

.qr { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.qr img { width: 200px; height: 200px; border-radius: 10px; background: #fff; padding: 8px; image-rendering: pixelated; }
.qr code { font: 12px var(--mono); word-break: break-all; color: var(--muted); }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--clay); }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); opacity: 0; transition: .2s; background: var(--raise); border: 1px solid var(--rule); padding: 9px 16px; border-radius: 9px; pointer-events: none; z-index: 10; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: var(--bad); color: var(--bad); }

/* ── Mobil ── */
.mobile-input { border-top: 1px solid var(--rule); background: var(--panel); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); display: grid; gap: 6px; }
.keys { display: flex; gap: 5px; overflow-x: auto; }
.keys button { flex: 0 0 auto; min-width: 42px; padding: 7px 9px; border-radius: 6px; border: 1px solid var(--rule); background: var(--ink); font: 12.5px var(--mono); }
.compose { display: flex; gap: 6px; }
.compose textarea { resize: none; max-height: 120px; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side-resize { display: none; }
  .settings { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .set-nav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--rule); padding: 10px; }
  .set-title { display: none; }
  .set-nav button { white-space: nowrap; }
  .set-nav { scrollbar-width: none; }
  .set-main .tab-body { padding: 14px 14px 20px; }
  .list li { flex-wrap: wrap; }
  .acc-usage { grid-template-columns: 1fr; gap: 6px; }
  .list .grow { flex: 1 0 calc(100% - 40px); }
  .side { position: fixed; inset: 0 auto 0 0; width: min(86vw, 320px); z-index: 5; transform: translateX(-102%); transition: transform .2s; box-shadow: 8px 0 30px rgb(0 0 0 / .4); }
  .app.drawer .side { transform: none; }
  .menu-btn { display: inline-block; }
  .acct-switch select { max-width: 130px; }
  .term { padding: 4px 2px 2px 4px; }
  .qr { grid-template-columns: 1fr; justify-items: center; }
}
