/*
  Repliken echter Poco-Komponenten (Chat-Drawer, Vorschlagskarte, Kachel,
  Mini-App, Journal, Export). Werte aus packages/app/src/client/app.css:
  Karte weiß auf 0.985, Rand 0.922, Radius Karte 16px, Primär oklch(0.525 0.211 3.958),
  Outfit für Überschriften, DM Sans für Text.
  Jede Variante darf die --pd-*-Token überschreiben.
*/
:root {
  --pd-canvas: oklch(0.985 0 0);
  --pd-card: oklch(1 0 0);
  --pd-ink: oklch(0.145 0 0);
  --pd-ink2: oklch(0.36 0 0);
  --pd-ink3: oklch(0.52 0 0);
  --pd-line: oklch(0.922 0 0);
  --pd-muted: oklch(0.97 0 0);
  --pd-primary: oklch(0.525 0.211 3.958);
  --pd-primary-ink: oklch(0.525 0.211 3.958);
  --pd-on-primary: oklch(0.971 0.014 343.198);
  --pd-tint: oklch(0.525 0.211 3.958 / 0.09);
  --pd-ok: oklch(0.62 0.15 150);
  --pd-shadow: 0 0 0 1px oklch(0 0 0 / 0.06), 0 1px 2px -1px oklch(0 0 0 / 0.08), 0 2px 6px -2px oklch(0 0 0 / 0.06);
  --pd-heading: "Outfit", "DM Sans", system-ui, sans-serif;
  --pd-sans: "DM Sans", system-ui, sans-serif;
  --pd-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --pd-ease: cubic-bezier(0.2, 0, 0, 1);
}

.pd { font-family: var(--pd-sans); color: var(--pd-ink); font-size: 13px; line-height: 1.45; position: relative; }
.pd * { box-sizing: border-box; }
.pd svg.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Sichtbarkeit je Schritt: ruhend ist alles an, der Lauf schaltet um. */
.pd [data-at] { transition: opacity 360ms var(--pd-ease), transform 420ms var(--pd-ease), max-height 420ms var(--pd-ease); }
.pd [data-at]:not(.on) { opacity: 0; transform: translateY(6px) scale(0.985); }
.pd [data-at].collapse:not(.on) { max-height: 0; margin: 0 !important; padding-block: 0 !important; overflow: hidden; }
.pd [data-at].collapse.on { max-height: 240px; }
.pd .pressed { transform: scale(0.94); filter: brightness(0.92); }

.pd-card { background: var(--pd-card); border-radius: 16px; box-shadow: var(--pd-shadow); }
.pd-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--pd-line); }
.pd-h { font-family: var(--pd-heading); font-weight: 600; font-size: 14px; letter-spacing: -0.005em; }
.pd-label { font-size: 10.5px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--pd-ink3); }
.pd-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 9px; font: 500 12.5px var(--pd-sans); border: 0; background: var(--pd-primary); color: var(--pd-on-primary); transition: transform 160ms var(--pd-ease), filter 160ms; }
.pd-btn.ghost { background: transparent; color: var(--pd-ink2); box-shadow: inset 0 0 0 1px var(--pd-line); }
.pd-chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; background: var(--pd-muted); color: var(--pd-ink2); font-size: 11.5px; white-space: nowrap; }
.pd-chip.brand { background: var(--pd-tint); color: var(--pd-primary-ink); }
.pd-num { font-family: var(--pd-heading); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

/* Chat-Drawer */
.pd-chat { display: flex; flex-direction: column; height: 100%; min-height: 330px; overflow: hidden; }
.pd-chat .pd-msgs { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 14px 12px; overflow: hidden; }
.pd-me { align-self: flex-end; max-width: 86%; padding: 9px 12px; border-radius: 16px 16px 4px 16px; background: var(--pd-muted); color: var(--pd-ink); }
.pd-agent { max-width: 92%; color: var(--pd-ink2); }
.pd-think { display: flex; gap: 4px; padding: 6px 2px; }
.pd-think i { width: 5px; height: 5px; border-radius: 50%; background: var(--pd-primary); opacity: 0.35; animation: pd-dot 900ms infinite ease-in-out; }
.pd-think i:nth-child(2) { animation-delay: 150ms; } .pd-think i:nth-child(3) { animation-delay: 300ms; }
@keyframes pd-dot { 50% { opacity: 1; transform: translateY(-2px); } }
.pd-proposal { border-radius: 14px; background: var(--pd-card); box-shadow: var(--pd-shadow); overflow: hidden; }
.pd-proposal .pd-bar { padding: 9px 12px; }
.pd-fields { display: flex; flex-wrap: wrap; gap: 5px; padding: 10px 12px; }
.pd-actions { display: flex; gap: 6px; justify-content: flex-end; padding: 0 12px 11px; }
.pd-done { display: flex; align-items: center; gap: 6px; color: var(--pd-ink2); font-size: 12px; }
.pd-done .i { color: var(--pd-ok); }
.pd-composer { margin: 0 10px 10px; padding: 10px 12px; border-radius: 16px; box-shadow: inset 0 0 0 1px var(--pd-line); display: flex; align-items: center; gap: 8px; color: var(--pd-ink3); background: var(--pd-card); }
.pd-composer > span:first-child { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd-send { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--pd-primary); color: var(--pd-on-primary); opacity: 0.5; }

/* Tabelle */
.pd-table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.pd-table th { text-align: left; font-weight: 500; color: var(--pd-ink3); padding: 7px 10px; border-bottom: 1px solid var(--pd-line); white-space: nowrap; }
.pd-table td { padding: 7px 10px; border-bottom: 1px solid var(--pd-line); white-space: nowrap; }
.pd-table tr:last-child td { border-bottom: 0; }
.pd-table tr.new td { background: var(--pd-tint); }
.pd-table .r { text-align: right; }

/* Fremdes Programm (Claude, ChatGPT): neutral, damit klar ist, dass es nicht Poco ist. */
.pd-ext { border-radius: 16px; background: var(--pd-muted); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.pd-ext-who { display: flex; align-items: center; gap: 7px; font-weight: 600; font-family: var(--pd-heading); font-size: 13px; }
.pd-ext-logo { width: 18px; height: 18px; display: grid; place-items: center; color: var(--pd-ink); }
.pd-ext-logo svg { width: 18px; height: 18px; }
.pd-jwho.logo { background: oklch(0.96 0.03 45); }
.pd-jwho.logo svg { width: 13px; height: 13px; }
.pd-ext-dot { width: 18px; height: 18px; border-radius: 6px; background: var(--pd-ink); color: var(--pd-card); display: grid; place-items: center; font-size: 10px; font-weight: 700; }
.pd-tool { display: flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 10px; background: var(--pd-card); box-shadow: inset 0 0 0 1px var(--pd-line); font: 11.5px var(--pd-mono); color: var(--pd-ink2); }
.pd-tool b { color: var(--pd-primary-ink); font-weight: 600; }
.pd-flow { display: grid; grid-template-columns: 1fr; gap: 10px; }

/* Kachel „Im Blick" */
.pd-tile { padding: 14px; display: flex; flex-direction: column; gap: 6px; min-height: 150px; }
.pd-tile-t { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; color: var(--pd-ink); }
.pd-tile-t .i { margin-top: 2px; color: var(--pd-ink2); }
.pd-tile .pd-num { font-size: 30px; line-height: 1; margin-top: auto; }
.pd-tile small { font-size: 12px; color: var(--pd-ink3); margin-left: 4px; font-family: var(--pd-sans); letter-spacing: 0; font-weight: 400; }
.pd-spark { width: 100%; height: 34px; overflow: visible; }
.pd-spark path { fill: none; stroke: var(--pd-ink); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.pd-spark .area { fill: var(--pd-tint); stroke: none; }
.pd-spark circle { fill: var(--pd-primary); }

/* Gedächtnis */
.pd-mem { display: flex; flex-direction: column; gap: 7px; padding: 12px; }
.pd-mem-row { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 11px; background: var(--pd-muted); font-size: 12.5px; }
.pd-mem-row .i { color: var(--pd-primary-ink); }
.pd-mem-row.fresh { background: var(--pd-tint); box-shadow: inset 0 0 0 1px oklch(0.525 0.211 3.958 / 0.2); }

/* Mini-App */
.pd-app { padding: 12px; display: grid; gap: 10px; }
.pd-app-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pd-field { display: grid; gap: 4px; }
.pd-field > span { font-size: 11px; color: var(--pd-ink3); }
.pd-step { display: flex; align-items: center; justify-content: space-between; height: 38px; border-radius: 11px; box-shadow: inset 0 0 0 1px var(--pd-line); padding: 0 4px; background: var(--pd-card); }
.pd-step b { font-family: var(--pd-heading); font-size: 17px; font-variant-numeric: tabular-nums; font-weight: 600; }
.pd-step i { font-style: normal; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: var(--pd-muted); color: var(--pd-ink2); transition: transform 160ms var(--pd-ease), background 160ms; }
.pd-step i.pressed { background: var(--pd-tint); color: var(--pd-primary-ink); }
.pd-sets { display: grid; gap: 4px; }
.pd-set { display: flex; justify-content: space-between; font-size: 12px; padding: 6px 9px; border-radius: 9px; background: var(--pd-muted); font-variant-numeric: tabular-nums; }
.pd-app .pd-btn { height: 36px; width: 100%; font-size: 13px; }

/* Journal */
.pd-journal { padding: 6px 12px 12px; display: grid; }
.pd-jrow { display: grid; grid-template-columns: auto 1fr auto; gap: 9px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--pd-line); font-size: 12px; }
.pd-jrow:last-child { border-bottom: 0; }
.pd-jwho { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 700; background: var(--pd-muted); color: var(--pd-ink2); }
.pd-jwho.poco { background: var(--pd-primary); color: var(--pd-on-primary); }
.pd-jrow time { display: block; color: var(--pd-ink3); font-size: 11px; font-variant-numeric: tabular-nums; }
.pd-jrow > span:nth-child(2) { min-width: 0; }
.pd-jrow .undo { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; font-size: 11px; box-shadow: inset 0 0 0 1px var(--pd-line); color: var(--pd-ink2); transition: transform 160ms var(--pd-ease); }
.pd-jrow .undo svg.i { width: 14px; height: 14px; }
.pd-jrow.gone > span:nth-child(2) { text-decoration: line-through; color: var(--pd-ink3); }

/* Export */
.pd-code { margin: 0; padding: 12px; font: 11.5px/1.6 var(--pd-mono); color: var(--pd-ink2); white-space: pre; overflow: hidden; }
.pd-code .k { color: var(--pd-primary-ink); }
.pd-code .n { color: var(--pd-ink); font-weight: 600; }
.pd-code > span { display: block; }

/* „Heute" im Telefon */
.pd-today { background: var(--pd-canvas); height: 100%; overflow: hidden; }
.pd-today-top { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--pd-line); background: var(--pd-card); }
.pd-today-top b { font-family: var(--pd-heading); font-size: 15px; }
.pd-live { width: 7px; height: 7px; border-radius: 50%; background: var(--pd-ok); }
.pd-today-body { padding: 12px; display: grid; gap: 8px; }
.pd-today-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pd-today .pd-tile { min-height: 112px; padding: 11px; }
.pd-today .pd-tile .pd-num { font-size: 24px; }
.pd-today .pd-tile-t { font-size: 12px; }
.pd-approw { display: flex; align-items: center; gap: 10px; padding: 12px; font-size: 13px; }

/* Zusätze der aufgeklappten Kacheln */
.pd-caps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.pd-cap { display: grid; gap: 8px; align-content: start; padding: 11px 12px; }
.pd-cap > .i { color: var(--pd-primary-ink); }
.pd-cap b { display: block; font-weight: 500; font-size: 12.5px; }
.pd-cap code { display: block; margin-top: 2px; font: 10.5px var(--pd-mono); color: var(--pd-ink3); overflow-wrap: anywhere; }
.pd-cap > span { min-width: 0; }
.pd-checks { display: grid; padding: 6px 12px 10px; }
.pd-checks > span { display: flex; align-items: center; gap: 9px; padding: 7px 0; font-size: 12.5px; border-bottom: 1px solid var(--pd-line); }
.pd-checks > span:last-child { border-bottom: 0; }
.pd-checks i { width: 17px; height: 17px; border-radius: 5px; box-shadow: inset 0 0 0 1.5px var(--pd-line); display: grid; place-items: center; }
.pd-checks .done { color: var(--pd-ink3); text-decoration: line-through; }
.pd-checks .done i { background: var(--pd-primary); box-shadow: none; color: var(--pd-on-primary); }
.pd-checks .done i .i { width: 11px; height: 11px; stroke-width: 3; }
.pd-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; height: 92px; margin-top: 8px; }
.pd-bars > span { display: grid; grid-template-rows: 1fr auto; gap: 5px; justify-items: center; }
.pd-bars i { align-self: end; width: 100%; border-radius: 5px 5px 2px 2px; background: color-mix(in oklab, var(--pd-ink) 14%, transparent); }
.pd-bars i.hi { background: var(--pd-primary); }
.pd-bars small { margin: 0; font-size: 10.5px; color: var(--pd-ink3); }
.pd-diff { display: grid; grid-template-columns: auto auto auto 1fr; gap: 8px 10px; align-items: center; padding: 12px; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.pd-diff > span:nth-child(4n + 1) { color: var(--pd-ink3); }
.pd-diff s { color: var(--pd-ink3); }
.pd-diff .to { color: var(--pd-ink3); }
.pd-diff b { font-weight: 600; justify-self: start; padding: 2px 7px; border-radius: 6px; background: var(--pd-tint); color: var(--pd-primary-ink); }
.pd-file { display: flex; align-items: center; gap: 10px; padding: 12px; }
.pd-file > .i { width: 22px; height: 22px; color: var(--pd-primary-ink); }
.pd-file b { display: block; font: 500 12.5px var(--pd-mono); }
.pd-file small { color: var(--pd-ink3); font-size: 11px; }
.pd-counts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pd-counts > span { padding: 11px 8px 9px; text-align: center; }
.pd-counts .pd-num { display: block; font-size: 22px; line-height: 1; }
.pd-counts small { display: block; margin-top: 6px; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--pd-ink3); }

/* Signet */
.pd-mark { display: grid; place-items: center; border-radius: 42% 58% 46% 54%; background: var(--pd-primary); color: var(--pd-on-primary); }
.pd-mark svg { width: 68%; height: 68%; }

/* Koralle */
svg.coral { overflow: visible; }
svg.coral path { fill: none; stroke: var(--coral-stroke, currentColor); stroke-linecap: round; stroke-dasharray: 1; }
svg.coral circle { fill: var(--coral-bud, currentColor); transform-box: fill-box; transform-origin: center; }
svg.coral.load path { stroke-dashoffset: 1; animation: coral-grow var(--d, 700ms) var(--pd-ease) forwards; animation-delay: var(--t, 0ms); }
svg.coral.load circle { transform: scale(0); animation: coral-bud 420ms var(--pd-ease) forwards; animation-delay: var(--t, 0ms); }
@keyframes coral-grow { to { stroke-dashoffset: 0; } }
@keyframes coral-bud { 60% { transform: scale(1.25); } to { transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  .pd [data-at], .pd .pressed { transition: none !important; }
  svg.coral.load path, svg.coral.load circle { animation: none; stroke-dashoffset: 0; transform: none; }
  .pd-think i { animation: none; opacity: 0.8; }
}
