:root {
  --bg: #0b0b10;
  --panel: #14141c;
  --panel-2: #1c1c27;
  --line: #262633;
  --text: #f2f2f7;
  --muted: #8b8b9e;
  --accent: #7c5cff;
  --accent-2: #25f4ee;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --tiktok: #25f4ee;
  --instagram: #e1306c;
  --youtube: #ff3b30;
  --other: #8b8b9e;
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-2); text-decoration: none; }

.app { display: flex; min-height: 100vh; }

/* Navigation: Seitenleiste am Laptop, Leiste unten am Handy */
.nav {
  width: 220px; flex-shrink: 0; padding: 24px 14px;
  border-right: 1px solid var(--line); background: #0e0e15;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.brand { font-weight: 700; font-size: 18px; padding: 0 10px 20px; display: flex; align-items: center; gap: 10px; }
.logo {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; font-size: 13px;
  background: linear-gradient(135deg, var(--accent), var(--instagram));
}
.nav button {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; border-radius: 10px;
  background: none; color: var(--muted); cursor: pointer; text-align: left; font-weight: 500;
}
.nav button:hover { background: var(--panel); color: var(--text); }
.nav button.active { background: var(--panel-2); color: var(--text); }
.nav .ico { width: 20px; text-align: center; font-size: 15px; }

main { flex: 1; min-width: 0; padding: 28px 32px 100px; max-width: 1200px; }
.loading { color: var(--muted); padding: 40px 0; }

h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -0.02em; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 600; }
.sub { color: var(--muted); margin: 0 0 22px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.head .sub { margin: 0; }

.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(4, 1fr); margin-bottom: 14px; }
.two { grid-template-columns: 1.4fr 1fr; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi .value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .hint { color: var(--muted); font-size: 12px; margin-top: 2px; }
.kpi.highlight { background: linear-gradient(135deg, #241a4d, #14141c 70%); border-color: #3a2d78; }

.section { margin-top: 14px; }
.row { display: flex; align-items: center; gap: 12px; }
.spread { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; font-weight: 600; }
.good { color: var(--good); }
.warn { color: var(--warn); }
.bad { color: var(--bad); }

/* Buttons */
.btn {
  border: 0; border-radius: 10px; padding: 9px 14px; cursor: pointer; font-weight: 600;
  background: var(--accent); color: #fff; white-space: nowrap;
}
.btn:hover { filter: brightness(1.1); }
.btn.ghost { background: var(--panel-2); color: var(--text); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.icon-btn { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 8px; font-size: 15px; }
.icon-btn:hover { background: var(--panel-2); color: var(--text); }

.fab {
  position: fixed; right: 24px; bottom: 24px; width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: linear-gradient(135deg, var(--accent), var(--instagram)); color: #fff; font-size: 28px; cursor: pointer;
  box-shadow: 0 10px 30px rgba(124, 92, 255, .45); z-index: 20;
}

/* Plattform-Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--panel-2); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.p-tiktok { color: var(--tiktok); } .p-tiktok .dot, .dot.p-tiktok { background: var(--tiktok); }
.p-instagram { color: var(--instagram); } .p-instagram .dot, .dot.p-instagram { background: var(--instagram); }
.p-youtube { color: var(--youtube); } .p-youtube .dot, .dot.p-youtube { background: var(--youtube); }
.p-other { color: var(--other); } .p-other .dot, .dot.p-other { background: var(--other); }

/* Listen */
.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item .main { flex: 1; min-width: 0; }
.item .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .meta { color: var(--muted); font-size: 13px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.views-btn {
  border: 1px solid var(--line); background: var(--panel-2); border-radius: 10px; padding: 6px 10px; cursor: pointer;
  font-variant-numeric: tabular-nums; font-weight: 700; min-width: 76px; text-align: right;
}
.views-btn:hover { border-color: var(--accent); }
.views-btn.auto { cursor: default; border-style: dashed; }
.empty { color: var(--muted); padding: 18px 0 6px; text-align: center; }
.thumb { flex-shrink: 0; width: 44px; height: 78px; border-radius: 8px; overflow: hidden; background: var(--panel-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tips { margin: 0; padding-left: 18px; }
.tips li { padding: 4px 0; }

/* Fortschritt */
.bar { height: 8px; background: var(--panel-2); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.goal { padding: 12px 0; border-top: 1px solid var(--line); }
.goal:first-of-type { border-top: 0; }

/* Diagramm */
.chart { width: 100%; height: 170px; display: block; }
.chart .b { fill: var(--accent); }
.chart .b:hover { fill: var(--accent-2); }
.chart text { fill: var(--muted); font-size: 10px; }
.split { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--panel-2); margin: 10px 0 12px; }
.split span { height: 100%; }

/* Filter */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 13px; color: var(--muted); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* Accounts */
.acc-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.acc .handle { font-size: 17px; font-weight: 700; margin: 8px 0 2px; overflow: hidden; text-overflow: ellipsis; }
.acc .stats { display: flex; gap: 18px; margin: 12px 0; }
.acc .links { display: flex; gap: 8px; flex-wrap: wrap; }

/* Aufgaben */
.task { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.task:first-child { border-top: 0; }
.task input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--accent); flex-shrink: 0; }
.task .t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.task.done .t { color: var(--muted); text-decoration: line-through; }
.quick { display: flex; gap: 8px; margin-bottom: 8px; }
.quick input { flex: 1; min-width: 0; }

/* Formulare / Dialog */
input, select, textarea {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
dialog {
  border: 1px solid var(--line); border-radius: 20px; background: var(--panel); color: var(--text);
  padding: 0; width: min(460px, calc(100vw - 32px)); max-height: 88vh; overflow: auto;
}
dialog form { padding: 22px; }
dialog::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(4px); }
dialog h2 { font-size: 19px; }
dialog .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.check { display: flex; align-items: center; gap: 10px; color: var(--text); margin-top: 14px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 14px;
  transition: .25s; pointer-events: none; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.client { padding: 14px 0; border-top: 1px solid var(--line); }
.client:first-child { border-top: 0; }
.order { display: flex; align-items: center; gap: 10px; padding: 7px 0 7px 12px; font-size: 14px; }
.order .t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pill { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; cursor: pointer; border: 0; }
.pill.paid { background: rgba(52, 211, 153, .15); color: var(--good); }
.pill.open { background: rgba(251, 191, 36, .15); color: var(--warn); }

@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .two { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .app { display: block; }
  .nav {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto; width: auto; height: auto; z-index: 30;
    flex-direction: row; justify-content: space-around; padding: 6px 4px calc(6px + var(--safe-b));
    border-right: 0; border-top: 1px solid var(--line); background: rgba(14, 14, 21, .92); backdrop-filter: blur(16px);
  }
  .brand { display: none; }
  .nav button { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 11px; flex: 1; align-items: center; }
  .nav button.active { background: none; color: var(--text); }
  .nav button.active .ico { color: var(--accent-2); }
  .nav .ico { font-size: 18px; }
  main { padding: calc(env(safe-area-inset-top, 0px) + 18px) 16px calc(110px + var(--safe-b)); }
  h1 { font-size: 24px; }
  .kpi .value { font-size: 22px; }
  .card { padding: 15px; }
  .fab { bottom: calc(78px + var(--safe-b)); right: 16px; width: 52px; height: 52px; }
  .item .meta .hide-sm { display: none; }
}
