/* ChatLog – DailyDo-Theme (Tokens aus dailydo-frontend-web/src/styles.css). Schriften selbst gehostet, OFL. */

@font-face { font-family: Figtree; font-weight: 400; font-style: normal; font-display: swap; src: url(fonts/figtree-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: Figtree; font-weight: 500; font-style: normal; font-display: swap; src: url(fonts/figtree-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: Figtree; font-weight: 600; font-style: normal; font-display: swap; src: url(fonts/figtree-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: Figtree; font-weight: 700; font-style: normal; font-display: swap; src: url(fonts/figtree-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Schibsted Grotesk'; font-weight: 600; font-style: normal; font-display: swap; src: url(fonts/schibsted-grotesk-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Schibsted Grotesk'; font-weight: 700; font-style: normal; font-display: swap; src: url(fonts/schibsted-grotesk-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Schibsted Grotesk'; font-weight: 800; font-style: normal; font-display: swap; src: url(fonts/schibsted-grotesk-latin-800-normal.woff2) format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 400; font-style: normal; font-display: swap; src: url(fonts/jetbrains-mono-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 500; font-style: normal; font-display: swap; src: url(fonts/jetbrains-mono-latin-500-normal.woff2) format('woff2'); }

:root {
  color-scheme: light;
  --r-box: 14px;
  --r-field: 9px;
  --font-sans: Figtree, ui-sans-serif, system-ui, sans-serif;
  --font-display: 'Schibsted Grotesk', Figtree, ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;

  --c-bg: 244 241 234;
  --c-surface: 255 253 249;
  --c-surface-2: 248 245 239;
  --c-line: 230 224 212;
  --c-line-strong: 210 202 187;
  --c-ink: 31 28 23;
  --c-muted: 93 87 76;
  --c-subtle: 116 109 96;
  --c-hover: rgb(60 45 20 / 0.055);

  --c-primary: 107 58 93;
  --c-primary-ink: 255 255 255;
  --c-primary-soft: 239 224 234;
  --c-primary-text: 93 49 81;

  --c-yellow: 242 207 78;
  --c-yellow-soft: 251 239 194;
  --c-yellow-text: 106 81 0;
  --c-ok: 59 119 72;
  --c-ok-soft: 224 238 220;
  --c-warn: 173 84 9;
  --c-warn-soft: 248 228 207;
  --c-err: 178 58 49;
  --c-err-soft: 246 221 217;
  --c-info: 46 95 154;
  --c-info-soft: 220 230 243;
  --c-neutral-soft: 236 231 220;
  --c-neutral-text: 93 87 76;

  --shadow: 0 1px 2px rgb(60 45 20 / 0.05), 0 4px 14px -6px rgb(60 45 20 / 0.1);
  --shadow-lg: 0 2px 4px rgb(60 45 20 / 0.05), 0 16px 40px -12px rgb(60 45 20 / 0.22);
}

:root.dark {
  color-scheme: dark;
  --c-bg: 22 21 19;
  --c-surface: 32 31 27;
  --c-surface-2: 39 37 32;
  --c-line: 52 49 43;
  --c-line-strong: 74 70 62;
  --c-ink: 242 238 230;
  --c-muted: 184 177 164;
  --c-subtle: 140 133 121;
  --c-hover: rgb(255 245 225 / 0.06);

  --c-primary: 226 171 209;
  --c-primary-ink: 42 17 36;
  --c-primary-soft: 54 32 47;
  --c-primary-text: 235 191 220;

  --c-yellow: 230 195 70;
  --c-yellow-soft: 58 49 19;
  --c-yellow-text: 241 214 117;
  --c-ok: 130 198 144;
  --c-ok-soft: 31 50 35;
  --c-warn: 240 165 96;
  --c-warn-soft: 59 41 23;
  --c-err: 240 139 129;
  --c-err-soft: 62 32 29;
  --c-info: 146 184 234;
  --c-info-soft: 29 42 61;
  --c-neutral-soft: 45 43 38;
  --c-neutral-text: 196 190 178;

  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 6px 18px -8px rgb(0 0 0 / 0.5);
  --shadow-lg: 0 2px 4px rgb(0 0 0 / 0.3), 0 20px 48px -14px rgb(0 0 0 / 0.6);
}

/* ---------------------------------------------------------------- Basis */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: rgb(var(--c-bg));
  color: rgb(var(--c-ink));
  font: 400 0.9375rem/1.5 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-family: var(--font-display); }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
::selection { background: rgb(var(--c-primary-soft)); color: rgb(var(--c-primary-text)); }
:focus-visible { outline: 2px solid rgb(var(--c-primary)); outline-offset: 2px; }
[hidden] { display: none !important; }
.spacer { flex: 1; }
.mono { font-family: var(--font-mono); }
.subtle { color: rgb(var(--c-subtle)); }
.nowrap { white-space: nowrap; }

svg.i {
  width: 16px; height: 16px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
svg.i-lg { width: 15px; height: 15px; stroke-width: 2.6; }

/* ---------------------------------------------------------------- Shell */

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgb(var(--c-bg) / 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgb(var(--c-line));
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 10px;
}
.topbar form { margin: 0; }

.logo { display: inline-flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; border-radius: 8px; }
.logo-mark {
  display: grid; place-items: center; width: 32px; height: 32px; flex-shrink: 0;
  border-radius: 10px 10px 10px 3px;
  background: rgb(var(--c-primary)); color: rgb(var(--c-primary-ink));
}
.logo-word { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; letter-spacing: -0.035em; }
.logo-word span { color: rgb(var(--c-primary-text)); }

.page { max-width: 1180px; margin: 0 auto; padding: 24px 16px 80px; }
@media (min-width: 721px) {
  .topbar-inner, .page { padding-left: 24px; padding-right: 24px; }
}
.page-head h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.2; }
.page-head p { margin-top: 4px; color: rgb(var(--c-muted)); }

/* ---------------------------------------------------------------- Bausteine */

.card {
  background: rgb(var(--c-surface));
  border: 1px solid rgb(var(--c-line));
  border-radius: var(--r-box);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; white-space: nowrap; cursor: pointer;
  border-radius: var(--r-field); border: 1.5px solid rgb(var(--c-line-strong));
  background: rgb(var(--c-surface)); color: rgb(var(--c-ink));
  font-size: 0.875rem; font-weight: 600;
  transition: background-color 0.15s, color 0.15s, filter 0.15s;
}
.btn:hover { background: rgb(var(--c-surface-2)); }
.btn:active { transform: translateY(1px); }
.btn-primary { border-color: rgb(var(--c-primary)); background: rgb(var(--c-primary)); color: rgb(var(--c-primary-ink)); }
.btn-primary:hover { background: rgb(var(--c-primary)); filter: brightness(1.1); }
.btn-ghost { border-color: transparent; background: transparent; color: rgb(var(--c-muted)); }
.btn-ghost:hover { background: var(--c-hover); color: rgb(var(--c-ink)); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 0.8125rem; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 0.9375rem; }
.btn-block { display: flex; width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0;
  border: 0; border-radius: 999px; background: transparent; color: rgb(var(--c-muted)); cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--c-hover); color: rgb(var(--c-ink)); }
.icon-btn-sm { width: 32px; height: 32px; }

.seg {
  display: inline-flex; gap: 2px; padding: 3px;
  border-radius: var(--r-field); border: 1px solid rgb(var(--c-line));
  background: rgb(var(--c-surface-2));
}
.seg button {
  display: inline-grid; place-items: center; height: 30px; min-width: 32px; padding: 0 8px;
  border: 0; border-radius: 7px; background: transparent; color: rgb(var(--c-muted)); cursor: pointer;
}
.seg button:hover { color: rgb(var(--c-ink)); }
.seg button[aria-pressed='true'] { background: rgb(var(--c-surface)); color: rgb(var(--c-ink)); box-shadow: var(--shadow); }

.field-label { display: block; margin-bottom: 6px; font-size: 0.8125rem; font-weight: 600; }
.field-input {
  width: 100%; height: 44px; padding: 0 14px;
  border-radius: var(--r-field); border: 1.5px solid rgb(var(--c-line-strong));
  background: rgb(var(--c-surface)); color: rgb(var(--c-ink));
  font-size: 0.875rem; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field-input::placeholder { color: rgb(var(--c-subtle)); }
.field-input:focus { border-color: rgb(var(--c-primary)); box-shadow: 0 0 0 3px rgb(var(--c-primary) / 0.2); }
.field-input:focus-visible { outline: none; }
select.field-input { padding-right: 10px; cursor: pointer; }
.field-icon { position: relative; }
.field-icon > svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: rgb(var(--c-subtle)); pointer-events: none; }
.field-icon > .field-input { padding-left: 40px; }

/* Pills: getönt mit Punkt. Gelb nur für «heute» / «jetzt». */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
  border-radius: 999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; vertical-align: middle;
}
.pill::before { content: ''; width: 6px; height: 6px; flex-shrink: 0; border-radius: 999px; background: currentColor; }
.pill-xs { height: 20px; padding: 0 8px; font-size: 0.6875rem; }
.pill-ok { background: rgb(var(--c-ok-soft)); color: rgb(var(--c-ok)); }
.pill-warn { background: rgb(var(--c-warn-soft)); color: rgb(var(--c-warn)); }
.pill-err { background: rgb(var(--c-err-soft)); color: rgb(var(--c-err)); }
.pill-info { background: rgb(var(--c-info-soft)); color: rgb(var(--c-info)); }
.pill-neutral { background: rgb(var(--c-neutral-soft)); color: rgb(var(--c-neutral-text)); }
.pill-primary { background: rgb(var(--c-primary-soft)); color: rgb(var(--c-primary-text)); }
.pill-today { background: rgb(var(--c-yellow-soft)); color: rgb(var(--c-yellow-text)); }
.pill-live::before { background: rgb(var(--c-yellow)); box-shadow: 0 0 0 0 rgb(var(--c-yellow) / 0.6); animation: live 1.8s ease-out infinite; }
@keyframes live { 0% { box-shadow: 0 0 0 0 rgb(var(--c-yellow) / 0.6); } 70%, 100% { box-shadow: 0 0 0 6px rgb(var(--c-yellow) / 0); } }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 999px; }
.dot-today { background: rgb(var(--c-yellow)); }

.alert-err {
  margin: 0 0 16px; padding: 10px 14px; border-radius: var(--r-field);
  background: rgb(var(--c-err-soft)); color: rgb(var(--c-err)); font-size: 0.875rem;
}

/* ---------------------------------------------------------------- Kennzahlen */

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 20px 0; }
@media (min-width: 721px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } }
.tile { padding: 16px 20px; min-width: 0; }
.tile-label {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 0.8125rem; font-weight: 600; color: rgb(var(--c-muted));
}
.tile-label svg { color: rgb(var(--c-subtle)); }
.tile-value {
  margin-top: 4px; font-family: var(--font-display); font-weight: 700; font-size: 1.75rem;
  line-height: 1.2; letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}
.tile-hint { font-size: 0.8125rem; color: rgb(var(--c-subtle)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------- Filter */

.filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
.filters > div { min-width: 0; }
.f-q, .f-user, .f-actions { grid-column: 1 / -1; }
.f-actions { display: flex; justify-content: flex-end; align-items: flex-end; gap: 8px; }
@media (min-width: 721px) {
  .filters { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .f-q { grid-column: span 7; }
  .f-user { grid-column: span 5; }
  .f-platform { grid-column: span 3; }
  .f-channel { grid-column: span 3; }
  .f-from { grid-column: span 3; }
  .f-to { grid-column: span 3; }
  .f-actions { grid-column: 1 / -1; }
}
@media (min-width: 1181px) {
  .f-q { grid-column: span 5; }
  .f-user { grid-column: span 4; }
  .f-platform { grid-column: span 3; }
  .f-channel { grid-column: span 3; }
  .f-from { grid-column: span 3; }
  .f-to { grid-column: span 3; }
  .f-actions { grid-column: span 3; }
}

/* ---------------------------------------------------------------- Tabs */

.tabs { display: flex; align-items: center; gap: 4px; margin: 24px 0 16px; border-bottom: 1px solid rgb(var(--c-line)); }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px;
  border: 0; background: none; cursor: pointer; font-weight: 600; color: rgb(var(--c-muted));
}
.tab:hover { color: rgb(var(--c-ink)); }
.tab[aria-selected='true'] { color: rgb(var(--c-ink)); }
.tab[aria-selected='true']::after {
  content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px;
  border-radius: 2px; background: rgb(var(--c-primary));
}
.result-info { font-size: 0.8125rem; color: rgb(var(--c-subtle)); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- Benutzerkarte */

.usercard { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; padding: 16px 20px; margin-bottom: 16px; }
.usercard-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar {
  display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0;
  border-radius: 12px 12px 12px 4px; background: rgb(var(--c-primary-soft)); color: rgb(var(--c-primary-text));
  font-family: var(--font-display); font-weight: 800; font-size: 1.125rem; text-transform: uppercase;
}
.usercard h2 { font-size: 1.125rem; font-weight: 700; letter-spacing: -0.015em; }
.usercard-sub { font-family: var(--font-mono); font-size: 0.75rem; color: rgb(var(--c-subtle)); overflow-wrap: anywhere; }
.kv { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 0; }
.kv dt { font-size: 0.75rem; font-weight: 600; color: rgb(var(--c-subtle)); }
.kv dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------------------------------------------------------------- Chat-Liste */

.chat { padding: 6px 0; }
.day {
  display: flex; align-items: center; gap: 10px; padding: 16px 20px 6px;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: rgb(var(--c-subtle));
}
.day::after { content: ''; flex: 1; height: 1px; background: rgb(var(--c-line)); order: 9; }
.day .pill { text-transform: none; letter-spacing: 0; }

.msg {
  position: relative; display: grid; grid-template-columns: 72px minmax(0, 1fr) 36px;
  gap: 2px 12px; align-items: start; padding: 5px 10px 5px 22px;
}
.msg:hover { background: var(--c-hover); }
.msg[data-edge]::before {
  content: ''; position: absolute; left: 8px; top: 7px; bottom: 7px; width: 4px; border-radius: 4px;
  background: var(--edge, transparent);
}
.msg.is-target { background: rgb(var(--c-primary) / 0.09); }
.msg-time { padding-top: 3px; font-family: var(--font-mono); font-size: 0.75rem; color: rgb(var(--c-subtle)); font-variant-numeric: tabular-nums; }
.msg-body { min-width: 0; line-height: 1.55; overflow-wrap: anywhere; }
.msg-user {
  padding: 0; margin-right: 6px; border: 0; background: none; cursor: pointer;
  font-weight: 700; color: rgb(var(--c-ink)); border-radius: 4px;
}
.msg-user:hover { color: rgb(var(--c-primary-text)); text-decoration: underline; text-underline-offset: 2px; }
.msg-meta { margin-right: 6px; font-family: var(--font-mono); font-size: 0.75rem; color: rgb(var(--c-subtle)); }
.msg-body .pill { margin-right: 6px; }
.msg-text { white-space: pre-wrap; }
.msg-text mark, td mark { border-radius: 4px; padding: 0 2px; background: rgb(var(--c-primary-soft)); color: rgb(var(--c-primary-text)); }
.msg-deleted .msg-text { color: rgb(var(--c-muted)); }
.msg-actions { opacity: 0; transition: opacity 0.15s; }
.msg:hover .msg-actions, .msg:focus-within .msg-actions { opacity: 1; }
@media (hover: none) { .msg-actions { opacity: 1; } }
@media (max-width: 720px) {
  .msg { grid-template-columns: minmax(0, 1fr) 32px; padding-right: 6px; }
  .msg-time { grid-column: 1; padding-top: 0; }
  .msg-body { grid-column: 1; }
  .msg-actions { grid-column: 2; grid-row: 1 / span 2; }
}

.sentinel { min-height: 1px; padding: 14px 20px; text-align: center; font-size: 0.8125rem; color: rgb(var(--c-subtle)); }
.sentinel:empty { padding: 0; }
.empty { padding: 56px 20px; text-align: center; }
.empty h3 { font-size: 1.0625rem; font-weight: 700; }
.empty p { margin-top: 4px; color: rgb(var(--c-muted)); font-size: 0.875rem; }

/* ---------------------------------------------------------------- Tabelle (Moderation) */

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.875rem; }
.data-table th {
  padding: 10px 12px; border-bottom: 1px solid rgb(var(--c-line)); text-align: left; white-space: nowrap;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: rgb(var(--c-subtle));
}
.data-table td { padding: 12px; border-bottom: 1px solid rgb(var(--c-line)); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table td:first-child, .data-table th:first-child { position: relative; padding-left: 22px; }
.data-table tr[data-edge] td:first-child::before {
  content: ''; position: absolute; left: 8px; top: 10px; bottom: 10px; width: 4px; border-radius: 4px;
  background: var(--edge, transparent);
}
.data-table tbody tr:hover td { background: var(--c-hover); }
.data-table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table .text { min-width: 220px; overflow-wrap: anywhere; }
@media (min-width: 721px) { .data-table th, .data-table td { padding-left: 16px; padding-right: 16px; } }

/* ---------------------------------------------------------------- Dialog, Toast, Nach oben */

dialog.dlg {
  width: min(780px, calc(100vw - 32px)); max-height: min(82vh, 780px); padding: 0;
  border: 1px solid rgb(var(--c-line)); border-radius: var(--r-box);
  background: rgb(var(--c-surface)); color: rgb(var(--c-ink)); box-shadow: var(--shadow-lg);
}
dialog.dlg[open] { display: flex; flex-direction: column; animation: rise 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
dialog.dlg::backdrop { background: rgb(20 16 10 / 0.45); animation: fade 0.18s ease-out; }
.dlg-head { display: flex; align-items: center; gap: 12px; padding: 14px 12px 14px 20px; border-bottom: 1px solid rgb(var(--c-line)); }
.dlg-head h2 { font-size: 1.0625rem; font-weight: 700; }
.dlg-head p { font-size: 0.8125rem; color: rgb(var(--c-muted)); }
.dlg-body { overflow-y: auto; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translateX(-50%);
  max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: var(--r-field);
  background: rgb(var(--c-ink)); color: rgb(var(--c-bg)); box-shadow: var(--shadow-lg);
  font-size: 0.875rem; font-weight: 600; animation: rise 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.to-top { position: fixed; right: 20px; bottom: 20px; z-index: 30; box-shadow: var(--shadow-lg); }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
.toast { animation-name: rise-toast; }
@keyframes rise-toast { from { opacity: 0; transform: translate(-50%, 12px); } }

/* ---------------------------------------------------------------- Anmeldung */

.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; padding: 32px 28px; }
.auth-title { margin-top: 24px; font-size: 1.5rem; font-weight: 800; letter-spacing: -0.025em; }
.auth-sub { margin: 4px 0 20px; color: rgb(var(--c-muted)); font-size: 0.9375rem; }
.auth-submit { margin-top: 16px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
