:root {
  /* Farben aus dem CreatorScope-Logo */
  --bg: #141414;
  --panel: #1b1b1b;
  --panel-2: #222222;
  --line: #2e2e2e;
  --text: #f2f2f2;
  --muted: #a3a3a3;
  --accent: #029e90;        /* Logo-Türkis */
  --accent-hover: #0bb5a5;
  --accent-light: #3fd3c3;
  --accent-dark: #09685f;   /* innerer Ring im Logo */
  --accent-ink: #ffffff;
  --accent-soft: rgba(2, 158, 144, .14);
  --accent-line: rgba(2, 158, 144, .45);
  --good: #3fd3c3;
  --hot: #ff7a59;
  --young: #e8b64c;
  --danger: #ff5a5f;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}

@font-face {
  font-family: "Montserrat";
  src: url("/static/fonts/Montserrat-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); }
a { color: inherit; text-decoration: none; }
input[type=checkbox], input[type=radio], input[type=range] { accent-color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* Kopfzeile */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; background: rgba(20, 20, 20, .92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo img { width: 36px; height: 36px; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.name { font: 700 21px "Montserrat", var(--font); letter-spacing: -.01em; color: #fff; }
.name .amp { color: var(--accent); }
.tagline { font-size: 11px; color: var(--muted); margin-top: 2px; }
@media (max-width: 1000px) { .tagline { display: none; } }
.actions { display: flex; gap: 8px; align-items: center; }
.last-analysis { margin-right: 6px; white-space: nowrap; }
.last-analysis.stale { color: var(--young); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font: 600 13px var(--font); cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { border-color: #3c3c3c; background: #282828; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; }
.btn.small { height: 30px; padding: 0 10px; font-size: 12px; }
.btn:disabled, .btn.disabled { opacity: .45; pointer-events: none; }
.icon-btn { background: none; border: 0; color: var(--muted); font-size: 24px; line-height: 1; cursor: pointer; padding: 2px 6px; }
.icon-btn:hover { color: var(--text); }

/* Fortschritt */
.progress { padding: 10px 24px 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.progress-track { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-dark), var(--accent), var(--accent-light)); transition: width .4s ease; }
.progress-text { margin-top: 6px; font-size: 13px; color: var(--muted); }
.progress-text strong { color: var(--text); }

.banner {
  margin: 16px 24px 0; padding: 12px 16px; border-radius: var(--radius);
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}

/* Layout */
.layout { display: grid; grid-template-columns: 320px 1fr; gap: 24px; padding: 20px 24px 40px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

.sidebar {
  position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
}
.sidebar-head { display: flex; align-items: baseline; justify-content: space-between; }
.sidebar h2 { margin: 0 0 12px; font-size: 15px; }
.counter { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.add-form { display: flex; gap: 8px; margin-bottom: 12px; }
.add-form .btn { width: 40px; padding: 0; font-size: 20px; }

input[type=text], input[type=search], input[type=number], input[type=password], select, textarea {
  width: 100%; height: 36px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: 13px var(--font); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }

.channel-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.channel-item { display: flex; align-items: center; gap: 10px; padding: 7px 6px; border-radius: 9px; cursor: pointer; }
.channel-item:hover { background: var(--panel-2); }
.channel-item.active { background: var(--accent-soft); }
.channel-item img { width: 32px; height: 32px; border-radius: 50%; flex: none; background: var(--line); }
.channel-info { min-width: 0; flex: 1; }
.channel-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel-sub.error { color: var(--danger); }
.channel-item .remove { opacity: 0; font-size: 18px; }
.channel-item:hover .remove { opacity: 1; }

/* Filter */
.filters {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: end;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
}
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--muted); min-width: 120px; }
.filters label.grow { flex: 1; min-width: 160px; }
.filters #f-factor { width: 90px; }
.filters label.check { flex-direction: row; align-items: center; gap: 6px; height: 36px; font-size: 13px; color: var(--text); min-width: 0; }
.result-head { margin: 14px 2px 10px; font-size: 13px; }

/* Karten */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; transition: transform .15s, border-color .15s;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent-line); }
.thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: #000; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.badge { position: absolute; border-radius: 7px; font-weight: 700; font-variant-numeric: tabular-nums; }
.badge.factor {
  top: 8px; left: 8px; padding: 4px 9px; font-size: 17px; letter-spacing: -.02em;
  background: var(--accent); color: var(--accent-ink); box-shadow: 0 2px 10px rgba(0,0,0,.4);
}
.badge.factor.hot { background: var(--hot); color: #fff; }
.badge.factor.low { background: rgba(20,20,20,.85); color: var(--text); }
.badge.young { top: 8px; right: 8px; padding: 3px 7px; font-size: 11px; background: var(--young); color: #2a1d00; }
.badge.duration { bottom: 8px; right: 8px; padding: 2px 6px; font-size: 11.5px; background: rgba(0,0,0,.8); color: #fff; }
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.title { font-weight: 650; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.title:hover { color: var(--accent); }
.meta { font-size: 12px; color: var(--muted); display: flex; gap: 6px; min-width: 0; }
.meta .channel { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 2px 0 0; }
.stats div { background: var(--panel-2); border-radius: 8px; padding: 6px 8px; }
.stats dt { font-size: 10.5px; color: var(--muted); }
.stats dd { margin: 0; font-weight: 650; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stats .sub { font-weight: 500; font-size: 11px; color: var(--muted); }
.stats .sub.up { color: var(--good); }
.card-actions { display: flex; gap: 6px; margin-top: auto; flex-wrap: wrap; }
.btn-note.assigned { border-color: var(--accent-line); color: var(--accent-light); }
.badge.note { bottom: 8px; left: 8px; padding: 2px 7px; font-size: 12px; background: #fff; color: var(--accent-dark); }
.card.assigned { border-color: var(--accent-line); }
.btn.danger { color: var(--danger); border-color: rgba(255, 90, 95, .4); }

.empty { padding: 60px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

/* Dialoge */
.dialog {
  width: min(560px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 16px;
  background: var(--panel); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.dialog.wide { width: min(900px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(2px); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 18px 10px; }
.dialog-head h3 { margin: 0; font-size: 16px; }
.dialog-head p { margin: 4px 0 0; }
.dialog-body { padding: 4px 18px 12px; }
.dialog-foot { display: flex; gap: 8px; align-items: center; padding: 12px 18px 16px; border-top: 1px solid var(--line); }
.spacer { flex: 1; }
#tr-text { height: 55vh; padding: 12px; line-height: 1.6; resize: vertical; font-size: 13.5px; }
.loading { display: flex; align-items: center; gap: 10px; padding: 40px 0; justify-content: center; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-box { padding: 14px; border-radius: 10px; background: rgba(255, 90, 95, .1); border: 1px solid rgba(255, 90, 95, .35); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; }
.form-grid label .small { font-weight: 400; }
.form-grid .full { grid-column: 1 / -1; }

/* Meldungen */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 50; max-width: 420px; }
.toast {
  background: var(--panel-2); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: 10px; padding: 12px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.5);
  display: flex; gap: 10px; align-items: flex-start; animation: slide .2s ease;
}
.toast.success { border-left-color: var(--good); }
.toast.error { border-left-color: var(--danger); }
.toast .toast-text { flex: 1; }
.toast ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 12px; }
@keyframes slide { from { transform: translateY(8px); opacity: 0; } }

/* --- Online-Version ------------------------------------------------------------ */
.invisible { visibility: hidden; }
.account-btn { gap: 8px; }
.plan-badge {
  padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; letter-spacing: .02em;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
}
.plan-badge[data-plan="creator"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-light); }
.plan-badge[data-plan="creator_pro"] { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (max-width: 1100px) { .account-label { display: none; } }

.add-form-block { margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.add-form-block .add-form { margin-bottom: 8px; }
.kind-switch { display: flex; gap: 14px; font-size: 12.5px; }
.kind-switch label { display: flex; align-items: center; gap: 5px; cursor: pointer; }
.kind-switch label.disabled { opacity: .45; cursor: not-allowed; }
.channel-section + .channel-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.channel-section .channel-list { margin-bottom: 4px; }
.meta .kind-tag { flex: none; padding: 0 6px; border-radius: 6px; font-size: 10.5px; line-height: 17px; background: var(--accent-soft); color: var(--accent-light); }
.card.own { border-color: rgba(63, 211, 195, .28); }
.note-text { height: 140px; padding: 10px; line-height: 1.5; resize: vertical; }

/* Konto */
.account-body { display: flex; flex-direction: column; gap: 18px; }
.account-body h4 { margin: 0; font-size: 13.5px; }
.plan-box { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.plan-box-head { display: flex; justify-content: space-between; align-items: baseline; color: var(--muted); font-size: 12px; }
.plan-box-head strong { color: var(--accent-light); font-size: 16px; }
.feature-list { margin: 8px 0; padding-left: 18px; font-size: 13px; }
.plan-box p { margin: 4px 0 0; }
.form-actions { display: flex; justify-content: flex-end; }

/* Anmeldeseiten */
.auth-page { min-height: 100vh; display: flex; }
.auth-wrap { margin: auto; width: min(420px, calc(100vw - 32px)); padding: 40px 0; }
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-logo { width: 64px; height: 64px; }
.auth-brand .name { font-size: 28px; margin-top: 8px; }
.auth-brand .tagline { font-size: 12.5px; }
.auth-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px 22px 18px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form h1 { margin: 0 0 2px; font-size: 19px; }
.auth-form p { margin: 0; }
.auth-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; }
.auth-form label .small { font-weight: 400; }
input[type=email] {
  width: 100%; height: 36px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: 13px var(--font); outline: none;
}
input[readonly] { opacity: .75; }
.btn.wide { width: 100%; height: 40px; font-size: 14px; }
.auth-links { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 12.5px; }
.auth-links a, .link-btn { color: var(--accent-light); }
.auth-links a:hover, .link-btn:hover { text-decoration: underline; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.notice { margin-bottom: 16px; padding: 10px 12px; border-radius: 10px; font-size: 13px; border: 1px solid var(--line); background: var(--panel-2); }
.notice.success { border-color: var(--accent-line); background: var(--accent-soft); }
.notice.error { border-color: rgba(255, 90, 95, .45); background: rgba(255, 90, 95, .1); }

/* Admin */
.admin { padding: 20px 24px 40px; max-width: 1300px; margin: 0 auto; }
.tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 10px 14px; font: 600 13.5px var(--font); cursor: pointer; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.stat strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 12px; }
.admin h3 { font-size: 14px; margin: 0 0 10px; }
.table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.table th, .table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; background: var(--panel-2); }
.table tr:last-child td { border-bottom: 0; }
.table select { width: auto; height: 30px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.form-row label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--muted); min-width: 150px; }
.form-row label:nth-child(2), .form-row label:nth-child(3) { flex: 1; min-width: 200px; }
.form-row #inv-days { width: 90px; }
.copy-row { display: flex; gap: 8px; }
#inv-result p { margin: 0 0 6px; }
