/* TPC Backlog. Tokens aus dem TPC-Brand-Guide: warmes Off-White, ein Teal, Lexend, Fraunces nur kursiv als Akzent. */
@font-face { font-family: 'Lexend'; src: url('/assets/fonts/LexendTPC-Light.woff2') format('woff2'); font-weight: 300; font-display: swap; }
@font-face { font-family: 'Lexend'; src: url('/assets/fonts/LexendTPC-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Lexend'; src: url('/assets/fonts/LexendTPC-Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Lexend'; src: url('/assets/fonts/LexendTPC-SemiBold.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url('/assets/fonts/Fraunces-Italic-500.woff2') format('woff2'); font-style: italic; font-weight: 500; font-display: swap; }

:root {
  --teal: #25A8AB; --teal-light: #4CBFC2; --teal-dark: #1A8386;
  --bg: #F7F5F2; --surface: #EDEAE5; --surface-2: #E2DED8;
  --text: #0D0D0D; --muted: #6B6B6B; --subtle: #A0A0A0; --warm: #E8694A;
  --font: 'Lexend', system-ui, sans-serif; --accent: 'Fraunces', Georgia, serif;
  --s1: 4px; --s2: 8px; --s3: 16px; --s4: 24px; --s5: 32px; --s6: 48px; --s7: 64px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --radius: 24px; --outer: 48px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.55 var(--font); min-height: 100dvh; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.muted { color: var(--muted); }
.label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0; }
.accent { font-family: var(--accent); font-style: italic; font-weight: 500; }
.accent--teal { color: var(--teal-dark); }
.stack { display: grid; gap: var(--s3); }

/* Hintergrund: weiche Blobs und Punktraster, bewusst leise */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(80px); }
.b1 { width: 520px; height: 520px; background: var(--teal-light); opacity: .15; top: -160px; right: -80px; }
.b2 { width: 440px; height: 440px; background: var(--warm); opacity: .10; bottom: -200px; left: -120px; }
.b3 { width: 380px; height: 380px; background: #C9A8E0; opacity: .16; top: 40%; left: 55%; }
.dots { position: absolute; inset: 0; background-image: radial-gradient(rgba(13,13,13,.0625) 1px, transparent 1px); background-size: 34px 34px; }

.glass {
  background: rgba(255,255,255,.46);
  -webkit-backdrop-filter: blur(14px) saturate(145%); backdrop-filter: blur(14px) saturate(145%);
  border: 1px solid rgba(255,255,255,.7); border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.62), 0 1px 3px rgba(13,13,13,.05), 0 8px 32px -16px rgba(13,13,13,.14);
}

.btn { border: 0; border-radius: 999px; padding: 12px 24px; font-weight: 500; cursor: pointer; transition: transform .2s var(--ease), background .2s, box-shadow .2s; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 44px; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn--primary { background: var(--teal-dark); color: #fff; }
.btn--primary:hover:not([disabled]) { background: #157073; box-shadow: 0 8px 24px -8px rgba(26,131,134,.5); }
.btn--ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--surface-2); }
.btn--ghost:hover:not([disabled]) { background: rgba(255,255,255,.6); }
.btn--warn { background: var(--warm); color: #fff; }
.btn--small { padding: 8px 16px; font-size: 13px; min-height: 36px; }

.field { display: grid; gap: var(--s2); font-size: 13px; color: var(--muted); }
.field input { border: 1px solid var(--surface-2); background: rgba(255,255,255,.8); border-radius: 16px; padding: 12px 16px; font-size: 16px; color: var(--text); }
.error { color: #B3401F; font-size: 13px; margin: var(--s3) 0 0; }

/* Anmeldung */
.login { min-height: 100dvh; display: grid; place-items: center; padding: var(--s4); }
.login__card { width: min(440px, 100%); padding: var(--s6) var(--s5); }
.login__logo { display: block; width: 180px; height: auto; margin-bottom: var(--s2); }
.login .label { margin-bottom: var(--s5); }
.claim { font-weight: 600; font-size: clamp(28px, 4vw, 40px); line-height: 1.15; margin: 0; letter-spacing: -.01em; }
.claim--hero { font-size: clamp(30px, 4.6vw, 56px); text-align: center; max-width: 18ch; margin: 0 auto var(--s5); }

/* Kopfzeile */
.top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--s3); padding: var(--s3) var(--outer); position: sticky; top: 0; z-index: 5; background: linear-gradient(var(--bg) 60%, rgba(247,245,242,0)); }
.top__logo { display: flex; align-items: center; gap: var(--s3); text-decoration: none; }
.top__logo img { height: 18px; width: auto; display: block; }
.tabs { display: flex; gap: var(--s1); padding: var(--s1); border-radius: 999px; background: rgba(255,255,255,.55); box-shadow: inset 0 0 0 1px rgba(255,255,255,.7), 0 4px 20px -12px rgba(13,13,13,.2); }
.tabs a { padding: 8px 16px; border-radius: 999px; text-decoration: none; font-size: 14px; font-weight: 500; color: var(--muted); transition: background .2s, color .2s; white-space: nowrap; }
.tabs a.is-on { background: var(--text); color: #fff; }
.top__user { display: flex; align-items: center; gap: var(--s3); justify-content: flex-end; font-size: 13px; }

.view { padding: var(--s4) var(--outer) var(--s7); max-width: 1440px; margin: 0 auto; }

/* Suche */
.search { padding-top: var(--s7); transition: padding .4s var(--ease); }
.search.is-active { padding-top: 0; }
.search.is-active .claim--hero { display: none; }
.search__bar { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s2) var(--s2) var(--s4); max-width: 880px; margin: 0 auto; border-radius: 999px; }
.search__bar svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search__bar input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 12px var(--s2); font-size: 18px; outline: none; }
.search__bar input::placeholder { color: var(--subtle); }
.search__bar input::-webkit-search-cancel-button { -webkit-appearance: none; }
.filters { display: flex; flex-wrap: wrap; gap: var(--s2); justify-content: center; max-width: 880px; margin: var(--s3) auto 0; }
.chip { border: 0; background: rgba(255,255,255,.5); box-shadow: inset 0 0 0 1px var(--surface-2); border-radius: 999px; padding: 8px 16px; font-size: 13px; cursor: pointer; color: var(--muted); min-height: 36px; }
.chip.is-on, .chip--select.is-on { background: var(--teal-dark); color: #fff; box-shadow: none; }
.chip--select { -webkit-appearance: none; appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236B6B6B' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 10px; }
.chip--tag { background: var(--surface); cursor: pointer; }
.chip--tag::after { content: ' ×'; }

.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); margin-top: var(--s5); align-items: start; }
.split.has-detail { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
.results { max-width: 880px; width: 100%; margin: 0 auto; }
.split.has-detail .results { max-width: none; }
.meta { font-size: 13px; color: var(--muted); margin: 0 0 var(--s3); min-height: 20px; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.list--dim { opacity: .8; }
.item { padding: var(--s3) var(--s4); border-radius: 20px; background: rgba(255,255,255,.42); border: 1px solid rgba(255,255,255,.7); cursor: pointer; transition: transform .2s var(--ease), box-shadow .2s, background .2s; }
.item:hover { background: rgba(255,255,255,.75); box-shadow: 0 8px 24px -12px rgba(37,168,171,.3); transform: translateY(-1px); }
.item.is-open { background: #fff; box-shadow: inset 0 0 0 2px var(--teal); }
.item__top { display: flex; justify-content: space-between; gap: var(--s3); font-size: 13px; color: var(--muted); }
.item__top span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item__top time { flex: none; }
.item h3 { margin: var(--s1) 0; font-size: 16px; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }
.item p { margin: 0; font-size: 14px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.item .reason { color: var(--teal-dark); font-size: 13px; margin-bottom: var(--s1); }
.item .reason::before { content: '→ '; }
mark { background: rgba(37,168,171,.2); color: inherit; border-radius: 4px; padding: 0 2px; }
.tags { display: flex; flex-wrap: wrap; gap: var(--s1); margin-top: var(--s2); }
.tag { font-size: 11px; letter-spacing: .02em; padding: 2px 8px; border-radius: 999px; background: var(--surface); color: var(--muted); border: 0; cursor: pointer; }
.tag:hover { background: var(--surface-2); color: var(--text); }
.tag--cat { background: rgba(37,168,171,.14); color: var(--teal-dark); text-transform: uppercase; letter-spacing: .08em; }
.tag--file { background: transparent; box-shadow: inset 0 0 0 1px var(--surface-2); }
.tag--warn { background: rgba(232,105,74,.14); color: #B3401F; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--surface-2); margin-right: 6px; }
.dot.ok { background: var(--teal); } .dot.warn { background: var(--warm); }

.answer { padding: var(--s4); margin-bottom: var(--s3); font-size: 16px; }
.answer .label { margin-bottom: var(--s2); color: var(--teal-dark); }
.answer p { margin: 0; }

/* Detail */
.detail { padding: var(--s5); position: sticky; top: 88px; max-height: calc(100dvh - 112px); overflow: auto; }
.detail__close { float: right; margin: -8px -8px 0 var(--s3); }
.detail h2 { margin: 0 0 var(--s2); font-size: 22px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.detail dl { display: grid; grid-template-columns: auto 1fr; gap: 2px var(--s3); margin: 0 0 var(--s4); font-size: 13px; }
.detail dt { color: var(--muted); } .detail dd { margin: 0; overflow-wrap: anywhere; }
.detail__actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s4); }
.box { background: rgba(255,255,255,.6); border-radius: 16px; padding: var(--s3); margin-bottom: var(--s3); font-size: 14px; }
.box .label { margin-bottom: var(--s2); }
.files { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.files li { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); font-size: 14px; }
.files a { overflow-wrap: anywhere; color: var(--teal-dark); text-decoration: none; font-weight: 500; }
.files small { color: var(--muted); white-space: nowrap; }
.body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.6; margin: 0; font-family: var(--font); }
.frame { width: 100%; height: 60vh; border: 0; border-radius: 16px; background: #fff; }
.seg { display: inline-flex; padding: 2px; border-radius: 999px; background: var(--surface); margin-bottom: var(--s3); }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; font-size: 13px; cursor: pointer; color: var(--muted); }
.seg button.is-on { background: #fff; color: var(--text); }
.thread { list-style: none; margin: 0; padding: 0; font-size: 13px; display: grid; gap: var(--s1); }
.thread a { text-decoration: none; display: flex; gap: var(--s2); justify-content: space-between; padding: 4px 0; }
.thread a:hover { color: var(--teal-dark); }

/* Chat */
.view--chat { max-width: 960px; }
.chat { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr auto; height: calc(100dvh - 136px); padding: var(--s4); }
.chat__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.chat__head h2 { margin: 0; font-size: 22px; font-weight: 600; }
.chat__controls { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.chat__controls select { border: 0; box-shadow: inset 0 0 0 1px var(--surface-2); background: rgba(255,255,255,.7); border-radius: 999px; padding: 8px 16px; font-size: 13px; max-width: 220px; min-height: 36px; }
.toggle { display: inline-flex; padding: 2px; border-radius: 999px; background: var(--surface); }
.toggle button { border: 0; background: transparent; padding: 6px 16px; border-radius: 999px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--muted); min-height: 32px; }
.toggle button.is-on { background: var(--text); color: #fff; }
.toggle button[data-mode="paid"].is-on { background: var(--warm); }
.chat__note { font-size: 13px; margin: var(--s2) 0 0; min-height: 20px; }
.chat__log { overflow: auto; padding: var(--s4) 0; display: flex; flex-direction: column; gap: var(--s3); }
.msg { max-width: 80%; padding: 12px 16px; border-radius: 20px; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg--user { align-self: flex-end; background: var(--text); color: #fff; border-bottom-right-radius: 4px; }
.msg--bot { align-self: flex-start; background: rgba(255,255,255,.8); border-bottom-left-radius: 4px; }
.msg--bot.is-thinking { color: var(--muted); font-style: italic; }
.msg--err { align-self: flex-start; background: rgba(232,105,74,.12); color: #B3401F; }
.chat__empty { margin: auto; text-align: center; color: var(--subtle); }
.chat__form { display: flex; gap: var(--s2); align-items: flex-end; }
.chat__form textarea { flex: 1; min-width: 0; resize: none; border: 1px solid var(--surface-2); background: rgba(255,255,255,.85); border-radius: 20px; padding: 12px 16px; max-height: 200px; outline: none; font-size: 16px; }
.chat__form textarea:focus { border-color: var(--teal); }

/* Status */
.status { display: grid; gap: var(--s4); max-width: 1040px; margin: 0 auto; }
.status h2 { font-size: 22px; font-weight: 600; margin: 0 0 var(--s3); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s3); }
.card { padding: var(--s4); }
.card h3 { margin: 0 0 var(--s1); font-size: 16px; font-weight: 500; overflow-wrap: anywhere; }
.card p { margin: 0 0 var(--s2); font-size: 14px; color: var(--muted); }
.card .btn { margin-top: var(--s2); }
.num { font-size: 32px; font-weight: 600; line-height: 1.1; letter-spacing: -.02em; }
.num small { font-size: 13px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: var(--s2) 0; }
.bar i { display: block; height: 100%; background: var(--teal); border-radius: 999px; transition: width .6s var(--ease); }
.bar.warn i { background: var(--warm); }
.banner { padding: var(--s4); border-radius: var(--radius); background: rgba(232,105,74,.10); border: 1px solid rgba(232,105,74,.3); font-size: 14px; }
.banner h3 { margin: 0 0 var(--s2); font-size: 16px; font-weight: 600; }
.banner ol { margin: var(--s2) 0 0; padding-left: 20px; } .banner li { margin-bottom: var(--s1); }
.banner code, .status code { background: rgba(255,255,255,.7); padding: 1px 6px; border-radius: 6px; font-size: 13px; overflow-wrap: anywhere; }
.row { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.drop { border: 1.5px dashed var(--surface-2); border-radius: 20px; padding: var(--s4); text-align: center; color: var(--muted); font-size: 14px; cursor: pointer; }
.drop.is-over { border-color: var(--teal); background: rgba(37,168,171,.08); }
.check { display: inline-flex; gap: var(--s2); align-items: center; font-size: 14px; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: var(--s4); transform: translateX(-50%); background: var(--text); color: #fff; padding: 12px 24px; border-radius: 999px; font-size: 14px; z-index: 20; max-width: calc(100vw - 32px); box-shadow: 0 12px 40px -12px rgba(0,0,0,.4); }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.spin--dark { border-color: var(--surface-2); border-top-color: var(--teal-dark); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

@media (max-width: 1023px) {
  :root { --outer: 32px; }
  .split.has-detail { grid-template-columns: minmax(0, 1fr); }
  .detail { position: fixed; inset: 0; z-index: 10; max-height: none; border-radius: 0; background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; padding: var(--s4); padding-top: calc(var(--s4) + env(safe-area-inset-top)); }
}
@media (max-width: 767px) {
  :root { --outer: 16px; --radius: 20px; }
  .top { grid-template-columns: 1fr auto; row-gap: var(--s2); padding-top: calc(var(--s2) + env(safe-area-inset-top)); }
  .top__logo .label { display: none; }
  .tabs { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; justify-content: space-between; }
  .tabs a { flex: 1; text-align: center; padding: 8px; }
  #userMail { display: none; }
  .view { padding-top: var(--s3); }
  .search { padding-top: var(--s5); }
  .search__bar { padding-left: var(--s3); }
  .search__bar input { font-size: 16px; }
  .search__bar .btn { padding: 12px 16px; }
  .filters { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; padding-bottom: var(--s1); margin-left: calc(var(--outer) * -1); margin-right: calc(var(--outer) * -1); padding-left: var(--outer); padding-right: var(--outer); scrollbar-width: none; }
  .filters::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .item { padding: var(--s3); }
  .msg { max-width: 92%; }
  .chat { height: calc(100dvh - 176px); padding: var(--s3); }
  .chat__form .btn { padding: 12px 16px; }
  .login__card { padding: var(--s5) var(--s4); }
}
