:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1d212b;
  --border: #2a2f3a;
  --text: #e6e8ee;
  --muted: #9aa3b2;
  --accent: #6c5ce7;
  --accent-2: #00b894;
  --danger: #e17055;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.muted { color: var(--muted); }
.error { color: var(--danger); }

/* --- Login --- */
.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
}
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: min(360px, 90vw);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-card h1 { margin: 0; font-size: 20px; }
.login-card input,
.login-card button {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 15px;
}
.login-card input { background: var(--panel-2); color: var(--text); }
.login-card button {
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

/* --- Topbar --- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent-2);
}
.topbar .status { flex: 1; font-size: 13px; color: var(--muted); }
.topbar .actions { display: flex; gap: 8px; }

/* --- Buttons --- */
.btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.btn.ghost { background: transparent; color: var(--text); }
.btn.ghost:hover { background: var(--panel-2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.like.liked { background: var(--danger); color: #fff; border-color: transparent; }

/* --- List + Cards --- */
.list {
  max-width: 820px;
  margin: 24px auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.empty { text-align: center; padding: 60px 0; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: opacity 0.25s ease;
}
.card.removing { opacity: 0; }

.card-head { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  object-fit: cover; background: var(--panel-2);
}
.who { flex: 1; min-width: 0; }
.who .name { font-weight: 600; }
.who .sub {
  display: flex; gap: 8px; align-items: center;
  font-size: 12px; color: var(--muted); flex-wrap: wrap;
}
.group-badge {
  padding: 2px 8px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--border);
  font-weight: 600; color: var(--text);
}
.open-link {
  color: var(--muted); text-decoration: none; font-size: 18px;
  padding: 4px 8px; border-radius: 6px;
}
.open-link:hover { background: var(--panel-2); color: var(--text); }

.incoming {
  margin: 0;
  padding: 10px 14px;
  background: var(--panel-2);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}

.draft {
  width: 100%;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  resize: vertical;
}
.draft:focus { outline: 2px solid var(--accent); }

.card-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-status { margin-left: auto; font-size: 13px; }
.row-status.ok { color: var(--accent-2); }
.row-status.err { color: var(--danger); }

.badge-dry {
  background: var(--danger); color: #fff;
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
}
.err { color: var(--danger); }

/* --- App-Layout mit Sidebar --- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .brand { font-size: 16px; padding: 8px 8px 16px; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-link {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}
.nav-link:hover { background: var(--panel-2); }
.nav-link.active { background: var(--accent); color: #fff; }
.sidebar-foot { padding-top: 12px; border-top: 1px solid var(--border); }
.sidebar-foot .btn { width: 100%; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar .status { flex: 1; }
.view { flex: 1; }

/* --- Original-Post-Kontext (Kommentar-Karte) --- */
.post-ctx {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.post-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 8px 12px;
  font: inherit;
  text-align: left;
}
.post-toggle:hover { background: rgba(255, 255, 255, 0.03); }
.post-icon { opacity: 0.7; }
.post-title { flex: 1; font-weight: 600; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-thumb { width: 44px; height: 30px; object-fit: cover; border-radius: 4px; }
.post-toggle .chev { color: var(--muted); }
.post-body {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  color: var(--muted);
  max-height: 360px;
  overflow-y: auto;
}

/* --- Live-Calls --- */
.lc-toolbar {
  max-width: 900px;
  margin: 20px auto 0;
  padding: 0 16px;
}
.lc-classroom { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lc-input {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
}
#classroom-name { min-width: 240px; }
.lc-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.lc-head { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; }
.lc-toggle {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 12px;
  font: inherit;
  text-align: left;
  min-width: 0;
}
.lc-toggle:hover { background: var(--panel-2); }
.lc-toggle .chev { color: var(--muted); width: 12px; }
.lc-title-text { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-link { color: var(--accent); text-decoration: none; font-size: 13px; white-space: nowrap; padding: 6px 8px; }
.lc-link:hover { text-decoration: underline; }
.badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--panel-2);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.st-processed, .st-published { background: var(--accent-2); color: #062; border-color: transparent; }
.st-error { background: var(--danger); color: #fff; border-color: transparent; }
.st-processing, .st-publishing, .st-downloading { background: var(--accent); color: #fff; border-color: transparent; }
.lc-body { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--border); }
.lc-label { font-size: 12px; color: var(--muted); margin-top: 8px; }
.lc-count.err { font-weight: 700; }
.lc-title-input { width: 100%; }
.lc-desc {
  width: 100%;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  resize: vertical;
}
.lc-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lc-course {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
}
.lc-sep { flex: 1; }
.lc-rowstatus { font-size: 13px; }
.lc-rowstatus.ok { color: var(--accent-2); }
.lc-rowstatus.err { color: var(--danger); }
.lc-error { font-size: 12px; white-space: pre-wrap; }

@media (max-width: 640px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; }
  .nav { flex-direction: row; }
  .sidebar-foot { border: none; padding: 0; }
  .sidebar-foot .btn { width: auto; }
}
