/* ---------- Claude-Chat (Popup / Seitenleiste) ---------- */
/* Farben (--claude, --claude-weak, --on-claude, --warn …) stehen mit den übrigen in app.css */

/* Knopf in der Werkzeugleiste */
.tb.claude-tb {
  color: var(--claude);
  margin-left: 2px;
}
.tb.claude-tb.active {
  background: var(--claude-weak);
}

#claude-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  color: var(--text);
}
#claude-panel[hidden],
body.focus #claude-panel {
  display: none !important;
}
/* angedockt: eigene Spalte rechts neben der Notiz */
#claude-panel[data-mode='dock'] {
  flex: none;
  height: 100%;
  border-left: 1px solid var(--line);
  z-index: 21;
}
/* schwebend: frei verschiebbares Popup */
#claude-panel[data-mode='float'] {
  position: fixed;
  z-index: 35;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
/* schmale Fenster (Tablet hochkant, Handy): Blatt von unten */
#claude-panel[data-mode='sheet'] {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: min(72dvh, 640px);
  z-index: 35;
  border-top: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Griff zum Größe-Ändern */
.cc-resize {
  position: absolute;
  z-index: 3;
  touch-action: none;
}
#claude-panel[data-mode='dock'] .cc-resize {
  left: -5px;
  top: 0;
  bottom: 0;
  width: 10px;
  cursor: col-resize;
}
/* beim Darüberfahren zeigt eine lila Linie, dass sich die Breite ziehen lässt */
#claude-panel[data-mode='dock'] .cc-resize::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--claude);
  opacity: 0;
  transition: opacity 0.15s;
}
#claude-panel[data-mode='dock'] .cc-resize:hover::after,
#claude-panel[data-mode='dock'] .cc-resize:active::after {
  opacity: 0.7;
}
#claude-panel[data-mode='float'] .cc-resize {
  left: 0;
  top: 0;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
}
#claude-panel[data-mode='sheet'] .cc-resize {
  display: none;
}

/* Kopfzeile */
.cc-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 54px;
  padding: 0 8px 0 14px;
  border-bottom: 1px solid var(--line);
  user-select: none;
  -webkit-user-select: none;
}
#claude-panel[data-mode='dock'] .cc-head {
  height: calc(var(--tb-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
}
#claude-panel[data-mode='float'] .cc-head {
  cursor: grab;
  touch-action: none;
}
.cc-title {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
/* Das Claude-Zeichen: schlichtes Symbol wie die in der Werkzeugleiste, ohne getönte Kachel */
.cc-spark {
  flex: none;
  display: grid;
  place-items: center;
  color: var(--claude);
}
.cc-spark svg {
  width: 21px;
  height: 21px;
}
.cc-spark.big svg {
  width: 28px;
  height: 28px;
}
.cc-names {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}
.cc-names b {
  font-size: 15px;
}
.cc-sub {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cc-icon {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.cc-icon:hover {
  background: var(--hover);
  color: var(--text);
}
.cc-icon svg {
  width: 18px;
  height: 18px;
}

/* Verlauf */
.cc-msgs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 14px 8px;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  user-select: text;
  -webkit-user-select: text;
}
.cc-user {
  align-self: flex-end;
  max-width: 88%;
  padding: 8px 12px;
  border-radius: 14px 14px 4px 14px;
  background: var(--accent-weak);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
/* Die an die Nachricht festgehaltene Markierung ("📌 3 Objekte markiert") */
.cc-pinned {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  padding: 2px 9px 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--claude);
  font-size: 12px;
  font-weight: 600;
  white-space: normal;
}
.cc-pinned:hover:not(:disabled) {
  background: var(--claude-weak);
}
.cc-pinned:disabled {
  cursor: default;
  opacity: 0.7;
}
.cc-pinned svg {
  width: 13px;
  height: 13px;
}
.cc-bot {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.cc-md {
  align-self: stretch;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.cc-md > :first-child {
  margin-top: 0;
}
.cc-md > :last-child {
  margin-bottom: 0;
}
.cc-md p,
.cc-md ul,
.cc-md ol,
.cc-md pre,
.cc-md blockquote,
.cc-md .md-table {
  margin: 0 0 9px;
}
.cc-md ul,
.cc-md ol {
  padding-left: 22px;
}
.cc-md li + li {
  margin-top: 2px;
}
.cc-md .md-h {
  font-weight: 700;
  margin: 12px 0 5px;
}
.cc-md .md-h1 {
  font-size: 17px;
}
.cc-md .md-h2 {
  font-size: 15.5px;
}
.cc-md code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font: 12.5px/1.4 ui-monospace, 'Cascadia Code', Consolas, monospace;
}
.cc-md pre {
  padding: 9px 11px;
  border-radius: 9px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  overflow-x: auto;
}
.cc-md pre code {
  padding: 0;
  border: 0;
  background: none;
}
.cc-md blockquote {
  padding-left: 11px;
  border-left: 3px solid var(--line);
  color: var(--muted);
}
.cc-md hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 10px 0;
}
.cc-md a {
  color: var(--accent-text);
}
.cc-md .md-table {
  overflow-x: auto;
}
/* Vektorpfeil über einem Buchstaben (A⃗): gezeichnet statt als Schriftzeichen, weil die Schrift das kombinierende Zeichen nicht kennt */
.cc-md .vec {
  position: relative;
  display: inline-block;
}
.cc-md .vec::before {
  content: '';
  position: absolute;
  top: 0.08em;
  left: 50%;
  width: 0.62em;
  height: 0.3em;
  transform: translateX(-50%);
  background: currentColor;
  -webkit-mask: var(--vec-arrow) center / 100% 100% no-repeat;
  mask: var(--vec-arrow) center / 100% 100% no-repeat;
  --vec-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 6'%3E%3Cpath d='M0 3H11M8.3 .6 11.2 3 8.3 5.4' fill='none' stroke='black' stroke-width='1.1'/%3E%3C/svg%3E");
}
.cc-md .vec-l::before {
  transform: translateX(-50%) scaleX(-1);
}
.cc-md .vec-lr::before {
  --vec-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 6'%3E%3Cpath d='M.8 3H11.2M3.7 .6.8 3 3.7 5.4M8.3 .6 11.2 3 8.3 5.4' fill='none' stroke='black' stroke-width='1.1'/%3E%3C/svg%3E");
}
.cc-md table {
  border-collapse: collapse;
  font-size: 13px;
}
.cc-md th,
.cc-md td {
  padding: 4px 9px;
  border: 1px solid var(--line);
  text-align: left;
}
.cc-md th {
  background: var(--panel-2);
}

/* Was Claude gerade tut */
.cc-tool {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 11px 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12.5px;
}
.cc-tool-ico {
  flex: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--claude);
  border-right-color: transparent;
  animation: cc-spin 0.8s linear infinite;
}
.cc-tool.done .cc-tool-ico,
.cc-tool.err .cc-tool-ico {
  animation: none;
  border-color: transparent;
  background: var(--ok);
}
.cc-tool.err .cc-tool-ico {
  background: var(--danger);
}
/* … und was er dabei sieht: Zeile anklicken (bei den Sehen-Werkzeugen ist es gleich offen) */
.cc-toolbox {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  max-width: 100%;
}
.cc-tool.more {
  cursor: pointer;
}
.cc-tool.more:hover {
  background: var(--hover);
}
.cc-tool-label {
  min-width: 0;
  overflow-wrap: anywhere;
}
.cc-chev {
  flex: none;
  width: 6px;
  height: 6px;
  margin: 0 1px 2px 2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  opacity: 0.6;
  transform: rotate(45deg);
}
.cc-toolbox.open .cc-chev {
  margin-bottom: -2px;
  transform: rotate(-135deg);
}
.cc-look {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  max-width: 100%;
  margin-left: 10px;
  padding-left: 10px;
  border-left: 2px solid var(--claude);
}
.cc-look-detail {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
/* Kontrolle: jeder Schritt mit ✓ / ✗ / ◐ */
.cc-steps {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
  line-height: 1.4;
}
.cc-step {
  display: flex;
  gap: 7px;
}
.cc-step-mark {
  flex: none;
  width: 14px;
  font-weight: 700;
  text-align: center;
}
.cc-step.correct .cc-step-mark,
.cc-step-right {
  color: var(--ok);
}
.cc-step.wrong .cc-step-mark,
.cc-step-why {
  color: var(--danger);
}
.cc-step.partial .cc-step-mark {
  color: var(--warn-text);
}
.cc-step-body b {
  font-weight: 600;
}
.cc-shot {
  display: block;
  max-width: 100%;
  max-height: 230px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: zoom-in;
}
.cc-show {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--claude);
  font-size: 12px;
  font-weight: 600;
}
.cc-show:hover {
  background: var(--claude-weak);
}
.cc-show svg {
  width: 13px;
  height: 13px;
}
.cc-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.72);
  cursor: zoom-out;
}
.cc-lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  background: #fff;
}
@keyframes cc-spin {
  to {
    transform: rotate(360deg);
  }
}
.cc-typing {
  display: flex;
  gap: 4px;
  padding: 6px 2px;
}
.cc-typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--claude);
  opacity: 0.35;
  animation: cc-dot 1.1s ease-in-out infinite;
}
.cc-typing i:nth-child(2) {
  animation-delay: 0.15s;
}
.cc-typing i:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes cc-dot {
  50% {
    opacity: 1;
    transform: translateY(-3px);
  }
}
.cc-note {
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
}
.cc-note.warn {
  border-color: var(--warn);
}
.cc-err {
  padding: 8px 11px;
  border-radius: 9px;
  border: 1px solid var(--danger);
  color: var(--danger);
  font-size: 13px;
}
.cc-copy {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px 2px 5px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 12px;
}
.cc-copy:hover {
  background: var(--hover);
  color: var(--text);
}
.cc-copy svg {
  width: 14px;
  height: 14px;
}

/* Startansicht */
.cc-empty {
  margin: auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 4px;
  text-align: center;
}
.cc-empty p {
  margin: 0;
  max-width: 300px;
  color: var(--muted);
  font-size: 13px;
}
.cc-sugg {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-self: stretch;
  margin-top: 8px;
}
.cc-chip {
  padding: 9px 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  text-align: left;
}
.cc-chip:hover {
  border-color: var(--claude);
  background: var(--claude-weak);
}

/* Hinweis: nicht eingerichtet / nicht angemeldet */
.cc-setup {
  flex: none;
  margin: 0 12px 8px;
  padding: 11px 12px;
  border-radius: 11px;
  border: 1px solid var(--warn);
  background: var(--panel-2);
  font-size: 13px;
  user-select: text;
  -webkit-user-select: text;
}
.cc-setup p {
  margin: 4px 0 8px;
  color: var(--muted);
  line-height: 1.4;
}
.cc-setup .btn {
  height: 32px;
}
/* Geht der Chat gerade nicht: nur der Hinweis, keine Vorschläge und Schnellaktionen, die ins Leere liefen */
#claude-panel.is-blocked .cc-sugg,
#claude-panel.is-blocked .cc-quickrow {
  display: none;
}
#claude-panel.is-blocked .cc-send:disabled {
  opacity: 0.4;
  cursor: default;
}
.cc-cmd {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
  padding: 3px 3px 3px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.cc-cmd code {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  font: 12.5px/1.6 ui-monospace, 'Cascadia Code', Consolas, monospace;
}

/* Eingabe */
.cc-foot {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.cc-foot textarea {
  flex: 1;
  min-width: 0;
  max-height: 150px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  line-height: 1.4;
  resize: none;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}
.cc-foot textarea:focus {
  border-color: var(--claude);
}
.cc-foot textarea:disabled {
  opacity: 0.5;
}
.cc-send {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--claude);
  color: var(--on-claude);
}
.cc-send:hover {
  filter: brightness(1.08);
}
.cc-send svg {
  width: 19px;
  height: 19px;
}
.cc-send.stop svg {
  width: 15px;
  height: 15px;
}

/* Spracheingabe: Mikrofon-Knopf links vom Senden-Knopf; während der Aufnahme pulsiert er in der Claude-Farbe */
.cc-mic {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
}
.cc-mic[hidden] {
  display: none;
}
.cc-mic:hover:not(:disabled) {
  color: var(--text);
}
.cc-mic:disabled {
  opacity: 0.5;
}
.cc-mic svg {
  width: 19px;
  height: 19px;
}
.cc-mic.listening {
  border-color: var(--claude);
  background: var(--claude);
  color: var(--on-claude);
  animation: cc-mic-pulse 1.4s ease-out infinite;
}
@keyframes cc-mic-pulse {
  from {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--claude) 55%, transparent);
  }
  to {
    box-shadow: 0 0 0 12px transparent;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cc-mic.listening {
    animation: none;
  }
}

/* KI-Einstellungen (Modell, Denktiefe) */
.cc-icon.custom {
  color: var(--claude);
}
.popup.cc-pop {
  width: min(320px, calc(100vw - 24px));
}
.cc-settings {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 4px;
}
.cc-settings label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 4px;
}
.cc-settings select {
  height: 36px;
  padding: 0 8px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel-2);
}
.cc-settings .hint {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

/* Abo-Kontingent: zwei schmale Balken unter dem Eingabefeld (Antippen zeigt Einzelheiten) */
.cc-limits {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px 16px;
  flex-wrap: wrap;
  width: 100%;
  padding: 0 14px calc(8px + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
}
.cc-limits[hidden] {
  display: none;
}
.cc-limits:hover .cc-lim-name,
.cc-limits:hover .cc-lim-pct {
  color: var(--text);
}
/* mit Kontingentzeile: das Eingabefeld rückt an sie heran, die Fläche unten gehört der Zeile */
#claude-panel.has-limits .cc-foot {
  padding-bottom: 8px;
}
.cc-lim {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.cc-lim-pct {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.cc-lim.warn .cc-lim-pct,
.cc-lim-top b.warn {
  color: var(--warn-text);
}
.cc-lim.high .cc-lim-pct,
.cc-lim-top b.high {
  color: var(--danger);
}
.cc-bar {
  flex: none;
  display: block;
  width: 56px;
  height: 5px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.cc-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--claude);
}
.cc-bar.warn i {
  background: var(--warn-text);
}
.cc-bar.high i {
  background: var(--danger);
}
.cc-lim-pop {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 4px;
}
.cc-lim-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.cc-lim-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}
.cc-lim-row .cc-bar {
  width: 100%;
  height: 7px;
}
.cc-lim-row small {
  font-size: 12px;
  color: var(--muted);
}
.cc-lim-pop .hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

/* Zurücknehmen, Schnellaktionen */
.cc-undo {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  padding: 1px 7px 1px 5px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--claude);
  font-size: 12px;
  font-weight: 600;
}
.cc-undo:hover {
  background: var(--claude-weak);
}
.cc-undo svg {
  width: 13px;
  height: 13px;
}
.cc-tool.undone {
  opacity: 0.6;
}
.cc-undone {
  margin-left: 2px;
  font-style: italic;
}
.cc-undo-all {
  color: var(--claude);
}
.cc-quickrow {
  flex: none;
  display: flex;
  gap: 6px;
  padding: 6px 12px 0;
  overflow-x: auto;
  scrollbar-width: none;
  touch-action: pan-x;
}
.cc-quickrow::-webkit-scrollbar {
  display: none;
}
.cc-quick-btn {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px 6px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  font-size: 13px;
  white-space: nowrap;
  text-align: left;
}
.cc-quick-btn:hover {
  border-color: var(--claude);
  background: var(--claude-weak);
}
.cc-quick-btn svg {
  width: 15px;
  height: 15px;
  color: var(--claude);
}
/* Leiste an der Notiz, solange etwas markiert ist */
.cc-pill {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 11;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--claude);
  box-shadow: var(--shadow);
  max-width: calc(100% - 24px);
}
.cc-pill[hidden] {
  display: none;
}
.cc-pill-ico {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--claude);
}
.cc-pill-ico svg {
  width: 17px;
  height: 17px;
}
.cc-pill-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 11px 0 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.cc-pill-btn:hover {
  background: var(--claude-weak);
}
.cc-pill-btn svg {
  width: 15px;
  height: 15px;
  color: var(--claude);
}
