/* ============================================================================
   ARBEITSFLÄCHE · Oberfläche
   Farben und Grundmaße kommen aus tokens.css; Feinabstände stehen am Bauteil.
   Aufbau: Gerüst · Kopf · Gespräch · Arbeitsfläche · Fenster · Taskleiste ·
           Klassisches Dashboard · Native Bausteine · Palette · Schmal.
   ============================================================================ */

@font-face { font-family: 'Plex'; src: url('../fonts/plex-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Plex'; src: url('../fonts/plex-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Plex'; src: url('../fonts/plex-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }

html[data-look='dark'] { color-scheme: dark; }
html[data-look='light'] { color-scheme: light; }

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-m);
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
[hidden] { display: none !important; }
.ico { flex: none; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-tint); color: var(--ink); }

/* ---------- Gerüst ------------------------------------------------------- */
.shell {
  height: 100dvh;
  display: grid;
  grid-template-rows: var(--top-h) minmax(0, 1fr) var(--bar-h);
  background: var(--bg);
}
body:not([data-mode='classic']) .classic { display: none; }

/* ---------- Kopfleiste -------------------------------------------------- */
.topbar {
  position: relative;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px 0 13px;
  background: var(--top-bg);
  border-bottom: 1px solid var(--top-line);
  min-width: 0;
}
.brand { display: flex; align-items: center; gap: 9px; flex: none; }
.brand-mark {
  width: 27px; height: 27px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--brand-mark-bg); color: var(--brand-mark-ink);
}
.brand-mark .ico { width: 17px; height: 17px; }
.brand-type { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-size: 14px; font-weight: 600; letter-spacing: -0.015em; }
.brand-sub { font-size: 9px; letter-spacing: 0.11em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }

.ws-switch { position: relative; flex: none; }
.ws-btn {
  display: flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 8px 0 6px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel-2); color: var(--ink); font-size: 12px;
  max-width: 230px;
}
.ws-btn:hover { border-color: var(--line-2); background: var(--panel-3); }
.ws-btn .ico { color: var(--muted); }
.ws-logo {
  width: 20px; height: 20px; border-radius: 6px;
  display: grid; place-items: center;
  background: var(--accent-tint); color: var(--accent);
  font-size: 10px; font-weight: 600; flex: none;
}
.ws-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.ws-btn .caret { margin-left: 1px; color: var(--muted); }

.ws-menu {
  position: absolute; top: calc(100% + 7px); left: 0;
  width: 288px; padding: 5px;
  background: var(--panel); border: 1px solid var(--line-2);
  border-radius: 11px; box-shadow: var(--shadow-2); z-index: 60;
}
.ws-menu-item {
  display: flex; gap: 9px; align-items: center; width: 100%;
  padding: 8px; border: 0; border-radius: 8px; background: transparent; text-align: left;
}
.ws-menu-item:hover { background: var(--panel-2); }
.ws-menu-item[aria-checked='true'] { background: var(--accent-tint); }
.ws-menu-item .ws-logo { width: 26px; height: 26px; border-radius: 7px; font-size: 11px; }
.ws-menu-item span { display: flex; flex-direction: column; min-width: 0; }
.ws-menu-item b { font-size: 12.5px; font-weight: 500; }
.ws-menu-item small { font-size: 11px; color: var(--muted); }
.ws-menu-item .tick { margin-left: auto; color: var(--accent); }
.ws-menu-note { padding: 7px 9px 5px; font-size: 10.5px; color: var(--muted); border-top: 1px solid var(--line); margin-top: 4px; }

.mode {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px;
  background: var(--panel-3); border: 1px solid var(--line); border-radius: 9px; flex: none;
}
.mode button {
  display: flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 9px; border: 0; border-radius: 6px;
  background: transparent; color: var(--ink-2); font-size: 11.5px; font-weight: 500;
  white-space: nowrap;
}
.mode button:hover { color: var(--ink); }
.mode button[aria-pressed='true'] { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-1); }
.mode button[aria-pressed='true'] .ico { color: var(--accent); }

.top-ctx {
  display: flex; align-items: center; gap: 7px; min-width: 0;
  font-size: 11.5px; color: var(--muted); padding-left: 2px;
}
.top-ctx b { color: var(--ink-2); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-ctx .ico { color: var(--line-strong); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 7px; flex: none; }

.pal-btn {
  display: flex; align-items: center; gap: 7px;
  height: 31px; padding: 0 8px 0 9px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--muted); border-radius: 8px; font-size: 11.5px;
}
.pal-btn:hover { color: var(--ink); border-color: var(--line-2); }
.pal-btn kbd {
  font-family: var(--font); font-size: 10px; border: 1px solid var(--line);
  border-radius: 4px; padding: 1px 4px; color: var(--muted); background: var(--panel-3);
}

.agent-chip {
  display: flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 10px 0 4px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel-2); font-size: 12px; color: var(--ink);
}
.agent-chip:hover { border-color: var(--accent-line); background: var(--accent-tint); }
.agent-chip[aria-pressed='true'] { border-color: var(--accent-line); }
.agent-chip .dot { margin-left: 1px; }

.ava {
  width: 26px; height: 26px; border-radius: 50%;
  display: inline-grid; place-items: center; flex: none;
  background: var(--surface-avatar-bg);
  color: var(--surface-avatar-ink); font-size: 10px; font-weight: 600; letter-spacing: 0.01em;
  box-shadow: inset 0 0 0 1px var(--brand-mark-ring);
}

.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--status-ruhig); flex: none; }
.dot[data-status='arbeitet'], .dot[data-status='laeuft'] { background: var(--status-arbeitet); }
.dot[data-status='wartet'] { background: var(--status-wartet); }
.dot[data-status='fertig'] { background: var(--status-fertig); }
.dot.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.icon-btn {
  width: 28px; height: 28px; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); display: grid; place-items: center; flex: none;
}
.icon-btn:hover { background: var(--panel-3); color: var(--ink); }
.icon-btn:disabled { opacity: 0.4; }

/* ---------- Bühne ------------------------------------------------------- */
.stage {
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  overflow: hidden;
}
body[data-mode='classic'] .stage { grid-template-columns: minmax(0, 1fr); }
body[data-mode='classic'] .rail,
body[data-mode='classic'] .desk { display: none; }

/* Rigs-Vollfenster: keine linke Chatspalte. Die Rigs liegen als freie
   Fenster auf der Fläche, der Chat hängt am aktiven Rig (siehe .win-chat). */
body[data-mode='rigs'] .stage { grid-template-columns: minmax(0, 1fr); }
body[data-mode='rigs'] .rail { display: none; }
body[data-mode='rigs'] .desk { grid-column: 1; }
body[data-mode='rigs'] .desk-label,
body[data-mode='rigs'] .agent-pill { display: none; }
body[data-mode='rigs'][data-rigs-chat='0'] .desk { display: none; }
body[data-mode='rigs'][data-rigs-chat='0'] .rail {
  display: flex; width: min(100%, 840px); margin: 0 auto;
  border-right: 0;
}

/* ---------- Gespräch ---------------------------------------------------- */
.rail {
  min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--rail-bg);
  border-right: 1px solid var(--rail-line);
  position: relative; z-index: 10;
}
.rail-host { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.rail-head { display: flex; align-items: center; gap: 10px; padding: 14px 12px 10px 15px; flex: none; }
.rail-ava { width: 33px; height: 33px; border-radius: 10px; font-size: 11px; }
.rail-id { min-width: 0; }
.rail-id b { display: block; font-size: 13px; font-weight: 600; letter-spacing: -0.01em; }
.rail-role { color: var(--muted); font-weight: 400; }
.rail-id span { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-actions { margin-left: auto; display: flex; align-items: center; gap: 1px; }

.ctx-line {
  margin: 0 12px 8px; padding: 6px 8px;
  display: flex; align-items: center; gap: 7px; min-width: 0;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel-2); color: var(--muted); font-size: 11px;
}
.ctx-line .ico { color: var(--accent); }
.ctx-line b { color: var(--ink-2); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx-line .ctx-more { margin-left: auto; color: var(--muted); white-space: nowrap; }

.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-log {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 8px 15px 12px; display: flex; flex-direction: column; gap: 13px;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.chat-log::-webkit-scrollbar { width: 9px; }
.chat-log::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; border: 3px solid var(--rail-bg); }
.chat-intro { padding: 6px 1px 2px; }
.chat-intro h1 { font-size: 19px; font-weight: 600; letter-spacing: -0.02em; }
.chat-intro p { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }
.chat-day { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; padding-top: 2px; }

.msg { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.msg-who { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--muted); }
.msg-who .ava { width: 18px; height: 18px; font-size: 8px; border-radius: 6px; }
.msg-who b { font-weight: 500; color: var(--ink-2); }
.msg-who time { margin-left: 2px; }
.bubble {
  padding: 8px 11px; border-radius: 4px 10px 10px 10px;
  background: var(--bubble); color: var(--bubble-ink);
  font-size: 12.8px; line-height: 1.52;
  white-space: pre-wrap; overflow-wrap: anywhere;
  border: 1px solid var(--bubble-line);
}
.msg-user { align-items: flex-end; }
.msg-user .bubble { background: var(--bubble-user); color: var(--bubble-user-ink); border-radius: 10px 4px 10px 10px; border-color: transparent; }
.msg-agent .bubble b { font-weight: 600; }
.bubble .src { display: block; margin-top: 6px; font-size: 10.5px; opacity: 0.72; }

.step {
  display: flex; align-items: flex-start; gap: 7px;
  padding: 6px 1px 5px; font-size: 11.8px; color: var(--ink-2);
  border-top: 1px dashed var(--line);
}
.step .ico { color: var(--ok); margin-top: 1px; }
.step b { font-weight: 500; color: var(--ink); }
.step .step-meta { margin-left: auto; color: var(--muted); font-size: 10.5px; white-space: nowrap; }

.msg-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); color: var(--ink-2); font-size: 10.8px;
}
.chip-btn:hover { border-color: var(--accent-line); color: var(--ink); background: var(--accent-tint); }

.approval {
  border: 1px solid var(--warn); border-radius: 10px;
  background: var(--warn-tint); padding: 9px 10px;
  display: flex; flex-direction: column; gap: 6px;
}
.approval-head { display: flex; gap: 6px; align-items: center; font-size: 10.5px; color: var(--warn); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.approval b { font-size: 12.5px; font-weight: 500; color: var(--ink); }
.approval p { font-size: 11.5px; color: var(--ink-2); }
.approval-actions { display: flex; gap: 6px; padding-top: 2px; }
.approval.done { border-color: var(--line); background: var(--panel-2); }
.approval.done .approval-head { color: var(--muted); }

.typing { display: inline-flex; gap: 3px; padding: 11px; border-radius: 4px 10px 10px 10px; background: var(--bubble); width: fit-content; }
.typing i { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); animation: tipp 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes tipp { 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }

.suggests { display: flex; flex-wrap: wrap; gap: 5px; padding: 7px 13px 3px; flex: none; }
.sugg {
  max-width: 100%; text-align: left;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel-2); color: var(--ink-2);
  font-size: 11px; padding: 5px 9px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sugg:hover { border-color: var(--accent-line); background: var(--accent-tint); color: var(--ink); }

.composer {
  margin: 7px 11px 11px; padding: 6px 6px 6px 10px;
  border: 1px solid var(--composer-line); border-radius: 11px;
  background: var(--composer-bg);
  display: flex; flex-direction: column; gap: 3px; flex: none;
  transition: border-color var(--p-fast), box-shadow var(--p-fast);
}
.composer:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-tint); }
.composer textarea {
  border: 0; background: transparent; outline: 0; resize: none;
  min-height: 21px; max-height: 148px; padding: 3px 2px;
  font-size: 12.8px; line-height: 1.45; color: var(--ink);
}
.composer textarea::placeholder { color: var(--muted); }
.composer-row { display: flex; align-items: center; gap: 5px; }
.composer-hint { font-size: 10px; color: var(--muted); margin-right: auto; padding-left: 2px; }
.send {
  width: 29px; height: 29px; border: 0; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; flex: none;
}
.send:hover { filter: brightness(1.06); }
.send:disabled { opacity: 0.45; cursor: default; }
.rail-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 0 14px 10px; font-size: 10.5px; color: var(--muted); flex: none;
}
.rail-foot .dot { margin-right: 1px; }

/* ---------- Arbeitsfläche ------------------------------------------------ */
.desk {
  position: relative; min-width: 0; min-height: 0; overflow: hidden;
  background-color: var(--desk-bg);
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: -1px -1px;
}
.desk-label {
  position: absolute; left: 17px; top: 12px; z-index: 1;
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
  opacity: 0.75; pointer-events: none;
}
.windows { position: absolute; inset: 0; }
.snap-preview {
  position: absolute; z-index: 900; display: none; pointer-events: none;
  border: 1px solid var(--accent-line); background: var(--accent-tint);
  border-radius: 10px;
}

/* Startfläche: der leere Schreibtisch */
.desk-start {
  position: absolute; inset: 0; overflow-y: auto;
  display: flex; justify-content: center;
  padding: 44px 30px 64px;
}
.start-inner { width: min(100%, 940px); }
.start-eyebrow { font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.start-inner h1 { font-size: clamp(24px, 2.6vw, 31px); font-weight: 600; letter-spacing: -0.025em; margin-top: 6px; line-height: 1.15; }
.start-inner > p { color: var(--ink-2); font-size: 13px; margin-top: 7px; max-width: 62ch; }
.start-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin: 22px 0 26px; }
.start-mode {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  padding: 13px 14px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--panel); text-align: left;
  transition: border-color var(--p-fast), transform var(--p-fast);
}
.start-mode:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.start-mode[data-active='true'] { border-color: var(--accent-line); background: var(--accent-tint); }
.start-mode .sm-top { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500; color: var(--ink); }
.start-mode .sm-top .ico { color: var(--accent); }
.start-mode p { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.start-mode .sm-tag { font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); }
.start-group { margin-top: 16px; }
.start-group h2 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); font-weight: 500; margin-bottom: 7px; }
.start-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(216px, 1fr)); gap: 7px; }
.tile {
  display: flex; gap: 9px; align-items: flex-start; text-align: left;
  padding: 10px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); min-width: 0;
  transition: border-color var(--p-fast), transform var(--p-fast);
}
.tile:hover { border-color: var(--line-2); transform: translateY(-1px); }
.tile-ic { width: 29px; height: 29px; border-radius: 8px; background: var(--panel-3); color: var(--ink-2); display: grid; place-items: center; flex: none; }
.tile-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tile-text b { font-size: 12.3px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-text small { font-size: 10.8px; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tile.open { border-color: var(--accent-line); }
.tile.open .tile-ic { background: var(--accent-tint); color: var(--accent); }
.start-recent { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.start-note {
  margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 11px; color: var(--muted); display: flex; gap: 7px; align-items: flex-start;
}
.start-note .ico { color: var(--line-strong); margin-top: 1px; }

/* ---------- Fenster ----------------------------------------------------- */
.win {
  position: absolute; top: 0; left: 0;
  display: flex; flex-direction: column;
  min-width: 300px; min-height: 200px;
  background: var(--win-bg);
  border: 1px solid var(--win-line);
  border-radius: var(--win-radius);
  box-shadow: var(--win-shadow);
  overflow: hidden;
  will-change: transform;
}
.win.vorn { border-color: var(--win-focus-line); box-shadow: var(--win-shadow-focus); }
.win.kommt { animation: fenster-kommt 0.18s var(--p-ease); }
@keyframes fenster-kommt { from { opacity: 0; transform: translate(var(--wx, 0), calc(var(--wy, 0) + 8px)) scale(0.995); } }
.win.zieht { transition: none; user-select: none; }
.win.gross { border-radius: 0; }
.win[data-snap='links'], .win[data-snap='rechts'] { border-radius: 0; }

.win-head {
  height: var(--win-head-h); flex: none;
  display: flex; align-items: center; gap: 7px;
  padding: 0 5px 0 10px;
  background: var(--win-head);
  border-bottom: 1px solid var(--win-line);
  user-select: none; cursor: default;
  position: relative; z-index: 2;
}
.win:not(.vorn) .win-head { background: var(--win-head-2); }
.win:not(.vorn) .win-title b { color: var(--ink-2); }
.win-ico { color: var(--ink-2); display: grid; place-items: center; flex: none; }
.win-title { min-width: 0; display: flex; flex-direction: column; line-height: 1.18; }
.win-title b { font-size: 12.3px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win-sub { font-size: 10.3px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win-state { display: flex; align-items: center; gap: 5px; margin-left: 4px; font-size: 10.3px; color: var(--muted); white-space: nowrap; }
.win-who { margin-left: auto; display: flex; align-items: center; flex: none; }
.win-who .ava { width: 20px; height: 20px; font-size: 8px; border-radius: 50%; box-shadow: 0 0 0 2px var(--win-head); }
.win-who .ava + .ava { margin-left: -6px; }
.win-tools { display: flex; align-items: center; gap: 1px; opacity: 0; transition: opacity var(--p-fast); flex: none; }
.win:hover .win-tools, .win:focus-within .win-tools { opacity: 1; }
.win-tools button {
  height: 23px; padding: 0 5px; border: 0; border-radius: 5px;
  background: transparent; color: var(--muted); font-size: 10.5px;
  display: flex; align-items: center; gap: 3px;
}
.win-tools button:hover { background: var(--panel-3); color: var(--ink); }
.win-ctrls { display: flex; align-items: center; flex: none; margin-left: 1px; }
.win-ctrls button {
  width: 29px; height: 29px; border: 0; border-radius: 5px;
  background: transparent; color: var(--ink-2); display: grid; place-items: center;
}
.win-ctrls button:hover { background: var(--panel-3); color: var(--ink); }
.win-ctrls button.zu:hover { background: var(--risk); color: var(--btn-danger-ink); }

.win-body { flex: 1; min-height: 0; position: relative; display: flex; overflow: hidden; }
.win-body > iframe { width: 100%; height: 100%; border: 0; display: block; background: var(--win-bg); }
.win-body > .native { flex: 1; }
.win-fallback { margin: auto; padding: 24px; text-align: center; color: var(--muted); font-size: 12px; max-width: 420px; }
.win-fallback b { display: block; color: var(--ink-2); font-size: 13px; margin-bottom: 5px; }

.win-loading {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: var(--win-bg); color: var(--muted); font-size: 11.5px; gap: 8px;
  pointer-events: none; transition: opacity 0.2s;
}
.win-loading .spin {
  width: 18px; height: 18px; border: 2px solid var(--line-2); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.win-edge { position: absolute; z-index: 6; }
.win-edge[data-r='n'], .win-edge[data-r='s'] { left: 8px; right: 8px; height: 6px; cursor: ns-resize; }
.win-edge[data-r='n'] { top: -1px; }
.win-edge[data-r='s'] { bottom: -1px; }
.win-edge[data-r='o'], .win-edge[data-r='w'] { top: 8px; bottom: 8px; width: 6px; cursor: ew-resize; }
.win-edge[data-r='o'] { right: -1px; }
.win-edge[data-r='w'] { left: -1px; }
.win-edge[data-r='no'], .win-edge[data-r='nw'], .win-edge[data-r='so'], .win-edge[data-r='sw'] { width: 12px; height: 12px; }
.win-edge[data-r='no'] { top: -1px; right: -1px; cursor: nesw-resize; }
.win-edge[data-r='nw'] { top: -1px; left: -1px; cursor: nwse-resize; }
.win-edge[data-r='so'] { bottom: -1px; right: -1px; cursor: nwse-resize; }
.win-edge[data-r='sw'] { bottom: -1px; left: -1px; cursor: nesw-resize; }
.win.gross .win-edge { display: none; }

/* ---------- Taskleiste -------------------------------------------------- */
.taskbar {
  display: flex; align-items: center; gap: 3px;
  padding: 0 8px 0 5px;
  background: var(--bar-bg);
  border-top: 1px solid var(--bar-line);
  position: relative; z-index: 30; min-width: 0;
}
.bar-btn {
  height: 36px; padding: 0 8px; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink-2);
  display: flex; align-items: center; gap: 6px; font-size: 11.5px; flex: none;
}
.bar-btn:hover { background: var(--panel-3); color: var(--ink); }
.bar-btn.vorn { background: var(--panel-3); color: var(--ink); }
#start-btn[aria-expanded='true'] { background: var(--panel-3); color: var(--ink); }
#start-btn[aria-expanded='true'] .ico { color: var(--accent); }
.bar-btn .ico { color: var(--ink-2); }
.bar-btn.vorn .ico { color: var(--accent); }
.bar-sep { width: 1px; height: 21px; background: var(--line); margin: 0 3px; flex: none; }
.dock-list { display: flex; align-items: center; gap: 1px; min-width: 0; overflow: hidden; }
/* Die Taskleiste zeigt nur wenige, konfigurierbare Programme als Symbole. */
.dock-btn { position: relative; width: 37px; padding: 0; justify-content: center; }
.dock-btn .ico { width: 18px; height: 18px; }
.dock-btn.laeuft::after {
  content: ''; position: absolute; left: 50%; bottom: 2px; width: 5px; height: 3px;
  margin-left: -2.5px; border-radius: 2px; background: var(--accent); opacity: 0.8;
}
.dock-btn.vorn::after { width: 16px; margin-left: -8px; opacity: 1; }
.dock-badge {
  min-width: 14px; height: 14px; padding: 0 4px; border-radius: 7px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 9px; font-weight: 600; line-height: 14px; text-align: center;
  margin-left: -2px;
}
.shelf { display: flex; align-items: center; gap: 1px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.shelf::-webkit-scrollbar { display: none; }
.shelf-btn { width: 35px; padding: 0; justify-content: center; gap: 0; position: relative; }
.shelf-btn .dot { position: absolute; left: 5px; top: 7px; width: 5px; height: 5px; }
.shelf-btn .ico { width: 16px; height: 16px; }
.bar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; padding-left: 6px; }
.bar-state { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.bar-state b { font-weight: 500; color: var(--ink-2); }
.pal-sub { color: var(--muted); }
.bar-count { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Startmenü --------------------------------------------------- */
.start-scrim {
  position: fixed; inset: var(--top-h) 0 var(--bar-h) 0;
  z-index: 110; background: transparent;
}
.start-menu {
  position: fixed;
  left: 10px;
  bottom: calc(var(--bar-h) + 8px);
  z-index: 120;
  width: min(570px, calc(100vw - 20px));
  max-height: min(630px, calc(100dvh - var(--top-h) - var(--bar-h) - 20px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  box-shadow: var(--shadow-2);
  animation: start-in 0.16s var(--p-ease) both;
}
.start-menu-head {
  display: flex; align-items: center; gap: 9px;
  padding: 12px 13px 9px;
  flex: none;
}
.start-menu-head .ws-logo { width: 27px; height: 27px; border-radius: 8px; font-size: 11px; }
.start-menu-id { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.start-menu-id b { font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.start-menu-id span { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.start-agent { margin-left: auto; font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.start-menu-head .dot { flex: none; }
.start-search {
  display: flex; align-items: center; gap: 8px;
  margin: 0 12px 9px; padding: 0 9px;
  height: 34px; flex: none;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  color: var(--muted);
}
.start-search:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-tint); }
.start-search .ico { color: var(--muted); flex: none; }
.start-search input {
  width: 100%; min-width: 0; height: 30px; padding: 0;
  border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12px;
}
.start-search input::-webkit-search-cancel-button { cursor: pointer; }
.start-search kbd {
  font-family: var(--font); font-size: 9.5px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 4px; flex: none;
}
.start-menu-scroll {
  min-height: 0; overflow-y: auto; padding: 0 7px 8px;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.start-section { padding-top: 3px; }
.start-section + .start-section { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 8px; }
.start-section-head { display: flex; align-items: center; gap: 8px; padding: 2px 6px 5px; }
.start-section-head h2 { font-size: 10px; font-weight: 600; letter-spacing: 0.075em; text-transform: uppercase; color: var(--muted); }
.start-hint { margin-left: auto; font-size: 9.8px; color: var(--muted); }
.start-app-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; }
.start-app {
  display: flex; flex-direction: column; align-items: flex-start; gap: 7px;
  min-width: 0; min-height: 72px; padding: 8px;
  border: 1px solid transparent; border-radius: 9px;
  background: transparent; text-align: left;
}
.start-app:hover, .start-app:focus-visible { background: var(--panel-2); border-color: var(--line); }
.start-app[data-offen='1'] { background: var(--panel-2); }
.start-app-ico {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: var(--accent-tint); color: var(--accent); flex: none;
}
.start-app-text { min-width: 0; width: 100%; }
.start-app b { display: block; font-size: 11.3px; font-weight: 500; color: var(--ink); line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.start-app small { display: block; margin-top: 2px; font-size: 9.7px; color: var(--muted); line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.start-app[data-offen='1'] .start-app-ico { color: var(--accent-ink); background: var(--accent); }
.start-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; }
.start-subhead { padding: 8px 8px 2px; font-size: 9.5px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.start-subhead:first-child { padding-top: 1px; }
.start-row {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  padding: 7px 8px; border: 0; border-radius: 7px;
  background: transparent; color: var(--ink-2); text-align: left; font-size: 11.5px;
}
.start-row:hover, .start-row:focus-visible { background: var(--panel-2); color: var(--ink); }
.start-row .ico { color: var(--muted); flex: none; }
.start-row b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.start-row small { margin-left: auto; color: var(--muted); font-size: 9.6px; white-space: nowrap; }
.start-row[data-offen='1'] .ico { color: var(--accent); }
.start-section-empty { border-top: 0; }
.start-empty-inner { padding: 26px 12px 30px; text-align: center; color: var(--muted); }
.start-empty-inner .ico { display: block; margin: 0 auto 7px; width: 20px; height: 20px; }
.start-empty-inner b { display: block; font-size: 12px; color: var(--ink); font-weight: 500; }
.start-empty-inner p { margin-top: 3px; font-size: 10.8px; }
.start-empty-inner .btn { margin-top: 10px; }
.start-menu-foot {
  display: flex; align-items: center; gap: 7px; flex: none;
  padding: 8px 10px; border-top: 1px solid var(--line);
  background: var(--panel-2);
}
.start-foot-user {
  display: flex; align-items: center; gap: 7px; min-width: 0;
  padding: 4px 6px 4px 3px; border: 0; border-radius: 8px; background: transparent; text-align: left;
}
.start-foot-user:hover { background: var(--panel-3); }
.start-foot-user .ava { width: 27px; height: 27px; font-size: 9px; }
.start-foot-user span:last-child { min-width: 0; display: flex; flex-direction: column; }
.start-foot-user b { font-size: 11px; font-weight: 500; color: var(--ink); }
.start-foot-user small { font-size: 9.6px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.start-foot-actions { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.start-foot-btn {
  display: flex; align-items: center; gap: 5px; height: 28px; padding: 0 7px;
  border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 10.2px;
}
.start-foot-btn:hover { background: var(--panel-3); color: var(--ink); }
@keyframes start-in { from { opacity: 0; transform: translateY(9px) scale(0.985); } to { opacity: 1; transform: none; } }

/* ---------- Klassisches Dashboard --------------------------------------- */
.classic {
  grid-column: 1 / -1; min-height: 0; min-width: 0;
  display: grid; grid-template-columns: minmax(0, 1fr) 0;
  background: var(--bg); position: relative;
}
body[data-mode='classic'][data-dock='open'] .classic { grid-template-columns: minmax(0, 1fr) var(--dock-w); }
.classic-frame { position: relative; min-width: 0; min-height: 0; background: var(--classic-bg); }
.classic-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.classic-loading {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: var(--bg-2); color: var(--muted); font-size: 12px; gap: 10px;
}
.classic-loading .spin {
  width: 20px; height: 20px; border: 2px solid var(--line-2); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
.classic-dock {
  min-width: 0; min-height: 0; display: flex; flex-direction: column;
  background: var(--dock-bg); border-left: 1px solid var(--line);
  position: relative; z-index: 15;
}
body[data-mode='classic'][data-dock='closed'] .classic-dock { display: none; }
.classic-dock .rail-head { border-bottom: 1px solid var(--line); padding-bottom: 11px; }
.classic-native { position: absolute; inset: 0; display: flex; min-height: 0; background: var(--bg-2); }
.classic-native > .native { flex: 1; }
.view-select { display: flex; align-items: center; flex: none; }
.view-select select {
  height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--panel-2); color: var(--ink-2); font-size: 11.5px; max-width: 190px;
}
.linklike {
  border: 0; background: none; padding: 0; color: var(--accent); font-size: inherit;
  text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.wer-reihe { display: flex; align-items: center; }
.tick { display: inline-flex; color: var(--accent); }
.classic-dock .rail-head .rail-id span { color: var(--muted); }
.dock-context {
  margin: 0 12px 8px; padding: 7px 9px; border-radius: 8px;
  background: var(--accent-tint); border: 1px solid var(--accent-line);
  font-size: 10.8px; color: var(--accent);
  display: flex; align-items: center; gap: 6px;
}
.dock-context b { font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-pill {
  position: absolute; right: 16px; bottom: 15px; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 13px 0 5px;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--pill-bg); color: var(--ink);
  box-shadow: var(--shadow-2); font-size: 12px;
}
.agent-pill:hover { border-color: var(--accent-line); }
.agent-pill .ava { width: 28px; height: 28px; font-size: 10px; }
.agent-pill .ico { color: var(--muted); }
body[data-mode='classic'][data-dock='open'] .agent-pill { display: none; }
body[data-mode='studio'] .agent-pill { display: none; }

/* ---------- Native Bausteine ------------------------------------------- */
.native {
  width: 100%; height: 100%; overflow-y: auto;
  padding: 16px; display: flex; flex-direction: column; gap: 13px;
  background: var(--native-bg); font-size: 12.5px;
  scrollbar-width: thin;
}
.native-head h1 { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.native-head p { font-size: 11.8px; color: var(--muted); margin-top: 3px; }
.n-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 1px; background: var(--native-line); border: 1px solid var(--native-line);
  border-radius: 9px; overflow: hidden;
}
.n-stat { background: var(--panel); padding: 10px 11px; min-width: 0; }
.n-stat label { display: block; font-size: 9.8px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.n-stat b { display: block; font-size: 19px; font-weight: 600; letter-spacing: -0.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.n-stat small { display: block; font-size: 10.3px; color: var(--muted); margin-top: 1px; }
.n-panel { border: 1px solid var(--native-line); border-radius: 9px; background: var(--panel); overflow: hidden; }
.n-panel-head { display: flex; align-items: center; gap: 8px; padding: 9px 11px; background: var(--native-head); border-bottom: 1px solid var(--native-line); }
.n-panel-head h2 { font-size: 11.5px; font-weight: 500; letter-spacing: 0.01em; }
.n-panel-head span { margin-left: auto; font-size: 10.3px; color: var(--muted); }
.n-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.n-table th { text-align: left; padding: 6px 11px; font-size: 9.8px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--native-line); }
.n-table td { padding: 7px 11px; border-top: 1px solid var(--native-line); color: var(--ink-2); vertical-align: top; }
.n-table tr:first-child td { border-top: 0; }
.n-table tbody tr:hover td { background: var(--panel-2); }
.n-table td b { color: var(--ink); font-weight: 500; }
.n-row { display: flex; gap: 9px; align-items: flex-start; padding: 9px 11px; border-top: 1px solid var(--native-line); }
.n-row:first-child { border-top: 0; }
.n-row .grow { flex: 1; min-width: 0; }
.n-row b { display: block; font-size: 11.8px; font-weight: 500; color: var(--ink); }
.n-row p { font-size: 10.8px; color: var(--muted); margin-top: 1px; }
.n-row-actions { margin-top: 6px; }
.n-prose { font-size: 11.5px; color: var(--ink-2); line-height: 1.55; }
.n-check { align-items: center; cursor: pointer; }
.n-check input { accent-color: var(--accent); }
.n-check-text { font-size: 11.8px; }
.n-check-text.done { color: var(--muted); text-decoration: line-through; }
.n-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 6px; border-radius: 999px; font-size: 9.8px;
  background: var(--panel-3); color: var(--ink-2); white-space: nowrap;
}
.n-tag.ok { background: var(--ok-tint); color: var(--ok); }
.n-tag.warn { background: var(--warn-tint); color: var(--warn); }
.n-tag.risk { background: var(--risk-tint); color: var(--risk); }
.n-form { padding: 11px; display: grid; gap: 8px; }
.n-form label { display: grid; gap: 3px; font-size: 10.3px; color: var(--muted); }
.n-form input, .n-form textarea, .n-form select {
  height: 32px; border: 1px solid var(--line-2); border-radius: 7px;
  background: var(--panel-2); color: var(--ink); padding: 0 9px; font-size: 12px;
}
.n-form textarea { height: auto; min-height: 54px; padding: 7px 9px; resize: vertical; }
.n-form .n-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.n-empty { padding: 18px 12px; text-align: center; color: var(--muted); font-size: 11px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 10px;
  border: 1px solid var(--line-2); border-radius: 8px;
  background: var(--panel); color: var(--ink-2); font-size: 11.5px; font-weight: 500;
}
.btn:hover { border-color: var(--line-strong); color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.sm { height: 25px; padding: 0 8px; font-size: 10.8px; border-radius: 6px; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Befehlspalette --------------------------------------------- */
.palette {
  position: fixed; inset: 0; z-index: 200;
  background: var(--scrim);
  backdrop-filter: blur(3px);
  display: flex; justify-content: center; align-items: flex-start;
  padding: 11vh 16px 16px;
}
.palette-box {
  width: min(590px, 100%);
  background: var(--panel); border: 1px solid var(--line-2);
  border-radius: 13px; box-shadow: var(--shadow-overlay);
  overflow: hidden;
}
.palette-input { display: flex; align-items: center; gap: 9px; padding: 11px 13px; border-bottom: 1px solid var(--line); }
.palette-input .ico { color: var(--muted); }
.palette-input input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 13.5px; color: var(--ink); }
.palette-input kbd { font-family: var(--font); font-size: 9.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 1px 4px; }
.palette-list { max-height: 54vh; overflow-y: auto; padding: 5px; }
.pal-title { padding: 7px 8px 3px; font-size: 9.8px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.pal-item {
  width: 100%; display: flex; align-items: center; gap: 9px;
  padding: 7px 8px; border: 0; border-radius: 7px;
  background: transparent; text-align: left; font-size: 12.3px; color: var(--ink-2);
}
.pal-item .ico { color: var(--muted); }
.pal-item[aria-selected='true'] { background: var(--accent-tint); color: var(--ink); }
.pal-item[aria-selected='true'] .ico { color: var(--accent); }
.pal-item .kind { margin-left: auto; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.pal-empty { padding: 16px; text-align: center; color: var(--muted); font-size: 11.5px; }
.palette-foot { display: flex; gap: 12px; padding: 7px 11px; border-top: 1px solid var(--line); font-size: 9.8px; color: var(--muted); }

/* ---------- Einstellungen ----------------------------------------------- */
.settings {
  position: fixed; left: 50%; top: calc(var(--top-h) + 22px);
  transform: translateX(-50%); z-index: 240;
  width: min(650px, calc(100vw - 24px));
  max-height: calc(100dvh - var(--top-h) - var(--bar-h) - 32px);
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line-2);
  border-radius: 14px; box-shadow: var(--shadow-overlay);
  overflow: hidden; animation: start-in 0.16s var(--p-ease);
}
.settings-head { display: flex; align-items: center; gap: 10px; padding: 13px 12px 12px 15px; border-bottom: 1px solid var(--line); flex: none; }
.settings-mark { width: 31px; height: 31px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-tint); color: var(--accent); flex: none; }
.settings-id { min-width: 0; flex: 1; }
.settings-id h2 { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.settings-id p { margin-top: 1px; font-size: 10.8px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.settings-body { overflow-y: auto; padding: 2px 16px 10px; scrollbar-width: thin; }
.set-section { padding: 14px 0 15px; border-bottom: 1px solid var(--line); }
.set-section:last-child { border-bottom: 0; }
.set-head { display: flex; align-items: center; gap: 8px; }
.set-head h3 { font-size: 12.4px; font-weight: 600; letter-spacing: -0.005em; }
.set-count { margin-left: auto; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.set-note { margin-top: 4px; max-width: 58ch; font-size: 11px; line-height: 1.5; color: var(--muted); }
.set-grid { margin-top: 10px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.set-app {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel-2); text-align: left;
}
.set-app:hover { border-color: var(--line-2); background: var(--panel-3); }
.set-app[aria-pressed='true'] { border-color: var(--accent-line); background: var(--accent-tint); }
.set-app[data-limit='1'] { opacity: 0.6; }
.set-app-ico { width: 27px; height: 27px; border-radius: 7px; display: grid; place-items: center; background: var(--panel); color: var(--ink-2); flex: none; }
.set-app[aria-pressed='true'] .set-app-ico { background: var(--accent); color: var(--accent-ink); }
.set-app-name { min-width: 0; display: flex; flex-direction: column; line-height: 1.22; }
.set-app-name b { font-size: 11.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.set-app-name small { font-size: 9.8px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.set-mark { margin-left: auto; width: 16px; display: grid; place-items: center; color: var(--accent); flex: none; }
.set-hint { display: flex; align-items: flex-start; gap: 6px; margin-top: 9px; font-size: 10.4px; color: var(--muted); }
.set-hint .ico { margin-top: 1px; }
.set-looks { margin-top: 9px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.set-look { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); text-align: left; }
.set-look:hover { border-color: var(--line-2); }
.set-look[aria-pressed='true'] { border-color: var(--accent-line); background: var(--accent-tint); }
.set-look .ico { color: var(--muted); }
.set-look[aria-pressed='true'] .ico { color: var(--accent); }
.set-look span { display: flex; flex-direction: column; line-height: 1.25; }
.set-look b { font-size: 11.5px; font-weight: 500; }
.set-look small { font-size: 9.8px; color: var(--muted); }
.settings-foot { display: flex; align-items: center; gap: 8px; padding: 9px 13px; border-top: 1px solid var(--line); background: var(--panel-2); flex: none; }
.settings-foot .btn { margin-left: auto; }
.settings .btn.primary.sm { background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); }
.settings .btn.sm { height: 30px; padding: 0 12px; border-radius: 8px; font-size: 11.5px; }

/* ---------- Vollfenster: Chat ------------------------------------------- */
/* Das Gespräch liegt als eigenes Overlay über der Anwendung. Es wird nicht
   aus der Rail gelöst, sondern dorthin zurückgebracht, wo gearbeitet wird. */
.chat-voll {
  position: fixed; inset: 0; z-index: 250;
  display: flex; flex-direction: column;
  background: var(--rail-bg);
}
.chat-voll[hidden] { display: none; }
.chat-voll .chat { flex: 1; width: min(100%, 880px); min-height: 0; margin: 0 auto; border: 0; }
.chat-voll .rail-head { padding-top: 12px; }

/* Der Chat hängt im aktiven Rig. Ist das Fenster breit genug, steht er rechts;
   darunter wird er zum unteren Fach mit voller Breite. */
.win[data-chat='1'] { container-type: inline-size; }
.win-chat {
  display: none; min-width: 0; min-height: 0;
  border-left: 1px solid var(--line);
  background: var(--rail-bg);
}
.win[data-chat='1'] .win-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
}
.win[data-chat='1'] .win-chat { display: flex; }
.win-chat .chat { flex: 1; min-width: 0; min-height: 0; border: 0; }
.win-chat .rail-head { padding-top: 11px; }
@container (max-width: 640px) {
  .win[data-chat='1'] .win-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) minmax(210px, 42%);
  }
  .win-chat { border-left: 0; border-top: 1px solid var(--line); }
}

/* Die Akte bringt ihren eigenen Assistentenfuß mit; im Rigs-Modus sitzt der
   Chat bereits daneben bzw. darunter. */
body[data-mode='rigs'] .office-assist { display: none; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 12px);
  z-index: 300; opacity: 0; pointer-events: none;
  padding: 8px 13px; border-radius: 9px;
  background: var(--ink); color: var(--bg);
  font-size: 11.5px; box-shadow: var(--shadow-2);
  transition: opacity 0.18s, transform 0.18s;
  max-width: min(560px, calc(100vw - 32px));
}
.toast.da { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Schmale Ansichten ------------------------------------------ */
@media (max-width: 1220px) {
  :root, [data-workspace] { --rail-w: 366px; --dock-w: 360px; }
  .top-ctx { display: none; }
}
@media (max-width: 1000px) {
  :root, [data-workspace] { --rail-w: 336px; --dock-w: 340px; }
  .ws-name { max-width: 120px; }
  .pal-btn span { display: none; }
}
@media (max-width: 900px) {
  .mode button span { display: none; }
  .mode button { padding: 0 8px; }
  body[data-mode='classic'][data-dock='open'] .classic { grid-template-columns: minmax(0, 1fr) 0; }
  body[data-mode='classic'][data-dock='open'] .classic-dock {
    position: absolute; right: 0; top: 0; bottom: 0;
    width: min(390px, 94vw); display: flex;
    box-shadow: var(--shadow-dock);
  }
  .brand-sub { display: none; }
}
@media (max-width: 720px) {
  .topbar { gap: 8px; padding: 0 8px; }
  .brand-type { display: none; }
  .ws-name { display: none; }
  .pal-btn kbd { display: none; }
  #chip-name { display: none; }
  .view-select select { max-width: 118px; }
  .start-modes { grid-template-columns: 1fr; }
  .desk-start { padding: 28px 16px 48px; }
  .start-menu { left: 8px; right: 8px; width: auto; bottom: calc(var(--bar-h) + 6px); max-height: calc(100dvh - var(--top-h) - var(--bar-h) - 14px); }
  .start-app-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .start-list { grid-template-columns: 1fr; }
  .start-foot-btn span { display: none; }
  .start-foot-btn { width: 29px; justify-content: center; padding: 0; }
  .settings { top: calc(var(--top-h) + 10px); max-height: calc(100dvh - var(--top-h) - 20px); }
  body[data-mode='studio'] .stage { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) minmax(0, 0.86fr); }
  body[data-mode='studio'] .desk { grid-row: 1; }
  body[data-mode='studio'] .rail { grid-row: 2; border-right: 0; border-top: 1px solid var(--rail-line); }
  .taskbar .bar-state span { display: none; }
  /* Auf schmalen Fenstern bleiben die Werkzeuge als Symbole erreichbar. */
  .win-tools { opacity: 1; }
  .win-tools button span { display: none; }
  .win-state, .win-who { display: none; }
}

@media (max-width: 560px) {
  .set-grid { grid-template-columns: 1fr; }
  .set-looks { grid-template-columns: 1fr; }
  .settings-body { padding: 2px 12px 8px; }
}

@media (max-width: 480px) {
  .topbar { gap: 6px; padding: 0 6px; }
  .top-right { gap: 4px; }
  .pal-btn { padding: 0 7px; }
  .agent-chip { gap: 5px; padding: 0 7px 0 4px; }
}

@media (max-width: 360px) {
  #agent-chip { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* Angehefteter Chat in schmalen Panels: Kopf, Verlauf und Eingabe zählen;
   Vorschläge und Fußzeile würden den Verlauf sonst auf wenige Zeilen drücken. */
@container (max-width: 640px) {
  .win-chat .suggests,
  .win-chat .rail-foot,
  .win-chat .ctx-line { display: none; }
  .win-chat .rail-head { padding: 8px 10px; }
}

/* Vollansicht eines Eintrags: Die Detailakte füllt das Fenster, die Liste
   bleibt in ihrem eigenen Rig-Fenster. */
.win[data-fokus='1'] .rig-toolbar,
.win[data-fokus='1'] .rig-index,
.win[data-fokus='1'] .office-intake,
.win[data-fokus='1'] .rig-assist { display: none; }
.win[data-fokus='1'] .rig-main { display: block; }
.win[data-fokus='1'] .rig-side {
  width: 100%;
  max-width: none;
  border-left: 0;
  padding: 18px clamp(16px, 4vw, 34px) 24px;
}
.win[data-fokus='1'] .rig-detail-head h2 { font-size: clamp(18px, 2.4vw, 24px); }
.win[data-fokus='1'] .rig-fields { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
