/* Lab – Social (aus SocialPost): Plattform-Badges, Kalender, Warteschlange, Editor, Statistik */

/* ---------- Plattform-Badges & Status ---------- */
.pf {
  width: 22px; height: 22px; border-radius: 6px; flex: none;
  display: inline-grid; place-items: center; color: #fff; font-size: 12px; font-weight: 800;
  position: relative;
}
.pf svg { width: 14px; height: 14px; fill: currentColor; }
.pf-x { background: #000; }
.pf-youtube { background: #ff0033; }
.pf-instagram { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285AEB 90%); }
.pf-tiktok { background: #000; text-shadow: -1px -1px 0 #25f4ee, 1px 1px 0 #fe2c55; }
.pf-linkedin { background: #0a66c2; }
.pf.sm { width: 16px; height: 16px; border-radius: 4px; font-size: 9px; }
.pf.sm svg { width: 10px; height: 10px; }
.pf .st { position: absolute; right: -3px; bottom: -3px; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--panel); }
.st-pending { background: var(--accent); }
.st-publishing { background: var(--warn); }
.st-published { background: var(--ok); }
.st-failed { background: var(--danger); }
.pf-stack { display: inline-flex; gap: 3px; flex-wrap: wrap; }

.badge { font-size: 12px; font-weight: 500; padding: 3px 9px; border-radius: 999px; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.badge.scheduled { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.badge.review { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.badge.publishing, .badge.partial { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.badge.published { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.badge.failed { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }

/* ---------- Kalender ---------- */
.cal-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.cal { background: var(--panel); border: 0; border-radius: var(--radius); overflow: hidden; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head div { padding: 8px 10px; font-size: 12px; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line); }
.cal-cell {
  min-height: 112px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-width: 0; background: var(--panel); position: relative;
}
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.other { background: var(--panel-2); }
.cal-cell.other .num { opacity: .45; }
.cal-cell.selected { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-cell.drop { background: color-mix(in srgb, var(--accent) 12%, var(--panel)); }
.cal-cell .num { font-size: 13px; font-weight: 600; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-cell.today .num { background: var(--accent); color: var(--accent-text); }
.chip {
  display: flex; gap: 5px; align-items: center; min-width: 0;
  font: inherit; font-size: 12px; text-align: left;
  border: 0; border-left: 3px solid var(--c, var(--accent));
  background: var(--panel-2); color: var(--text);
  padding: 3px 6px; border-radius: 5px; cursor: pointer;
}
.chip .t { font-weight: 650; font-variant-numeric: tabular-nums; }
.chip .cap { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.chip.failed, .chip.partial { background: color-mix(in srgb, var(--danger) 14%, var(--panel)); }
.chip.published { opacity: .7; }
.chip.draft { border-left-style: dashed; }
.chip.review { background: color-mix(in srgb, var(--warn) 12%, var(--panel)); border-left-style: dashed; }
.movable { cursor: grab; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.movable.dragging { opacity: .4; }
body.sp-dragging, body.sp-dragging * { cursor: grabbing !important; }
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; max-width: 220px; padding: 6px 10px; border-radius: 10px;
  background: var(--panel); box-shadow: 0 6px 24px rgba(0, 0, 0, .25); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.free-slot.drop { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-cell .more { font-size: 12px; color: var(--muted); padding-left: 4px; }
.cal-cell .dots { display: none; }

.day-panel { position: sticky; top: 16px; display: grid; gap: 12px; }
.post-card {
  display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: start;
  background: var(--panel); border: 1px solid transparent; border-left: 4px solid var(--c, var(--line));
  border-radius: var(--radius); padding: 12px; cursor: pointer; text-align: left; font: inherit; color: inherit; width: 100%;
}
.post-card:hover { border-color: color-mix(in srgb, var(--text) 18%, transparent); border-left-color: var(--c, var(--accent)); }
.post-card .thumb { width: 56px; height: 56px; border-radius: 12px; background: var(--panel-2); object-fit: cover; display: grid; place-items: center; color: var(--muted); font-size: 20px; overflow: hidden; }
.post-card .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; font-size: 13px; }
.post-card .meta .time { font-weight: 700; font-variant-numeric: tabular-nums; }
.post-card .cap { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 14px; }
.post-card .err { color: var(--danger); font-size: 12px; margin-top: 4px; }

/* ---------- Accounts (Projekt-Einstellungen) ---------- */
.acc-list { display: grid; gap: 8px; }
.acc {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2);
}
.acc img.av { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.acc .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.acc .warn { color: var(--warn); font-size: 12px; }
.connect { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Speicherplatz ---------- */
.sp-meter { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--panel-2); border: 1px solid var(--line); }
.sp-meter .other { background: color-mix(in srgb, var(--muted) 45%, transparent); }
.sp-meter .media, .sw.media { background: var(--accent); }
.sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

/* ---------- Editor ---------- */
dialog.social-editor { width: min(760px, 100%); }
.sec { display: grid; gap: 8px; }
.sec > .lbl { font-size: 13px; font-weight: 650; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.acc-pick { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.toggle {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 6px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); cursor: pointer; font: inherit; font-size: 13px; color: var(--text);
}
.toggle.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--panel)); }
.toggle.bad { border-color: var(--warn); }
.social-editor textarea { min-height: 120px; resize: vertical; }
.counter { font-size: 12px; color: var(--muted); text-align: right; }
.counter .over { color: var(--danger); font-weight: 700; }
label.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
label.check input { width: auto; accent-color: var(--accent); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.media-item { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--panel-2); }
.media-item img, .media-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-item .bar { position: absolute; inset: auto 0 0 0; display: flex; justify-content: space-between; background: linear-gradient(transparent, rgba(0,0,0,.65)); padding: 14px 4px 4px; }
.media-item .bar button { border: 0; background: rgba(0,0,0,.45); color: #fff; border-radius: 6px; width: 26px; height: 26px; cursor: pointer; }
.media-item .kind { position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 5px; }
.media-gone { width: 100%; height: 100%; display: grid; place-content: center; justify-items: center; gap: 6px; text-align: center; padding: 8px; font-size: 26px; color: var(--muted); }
.media-gone span { font-size: 11px; line-height: 1.3; }
.drop {
  display: grid; place-items: center; text-align: center; gap: 4px; padding: 18px; border: 2px dashed var(--line);
  border-radius: 12px; color: var(--muted); cursor: pointer; font-size: 14px;
}
.drop.over { border-color: var(--accent); color: var(--accent); }
.drop input { display: none; }
.progress { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.progress div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }
details.opt { border: 1px solid var(--line); border-radius: 16px; padding: 0 16px; }
details.opt summary { padding: 12px 0; cursor: pointer; display: flex; align-items: center; gap: 8px; font-weight: 600; }
details.opt[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 12px; }
details.opt .grid-2 { margin-bottom: 14px; }
details.opt textarea { min-height: 80px; margin-bottom: 14px; }
.targets { display: grid; gap: 6px; }
.target { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; background: var(--panel-2); border-radius: 10px; font-size: 13px; }
.target .body { flex: 1; min-width: 0; }
.target .e { color: var(--danger); word-break: break-word; }
.errors { background: color-mix(in srgb, var(--danger) 12%, var(--panel)); color: var(--danger); border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.errors ul { margin: 6px 0 0; padding-left: 18px; }
.readonly-note { background: var(--panel-2); border-radius: 10px; padding: 10px 14px; font-size: 14px; }

/* ---------- Statistik ---------- */
.sp-spark { width: 100%; max-width: 160px; height: 32px; margin-top: 4px; }
.sp-spark path { fill: none; stroke: var(--muted); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; opacity: .6; }
.sp-spark circle { fill: var(--accent); stroke: var(--panel); stroke-width: 2; }
.sp-chart-host { position: relative; overflow: hidden; }
.sp-chart { display: block; }
.sp-chart .grid { stroke: var(--line); stroke-width: 1; }
.sp-chart .axis { stroke: color-mix(in srgb, var(--muted) 50%, var(--line)); stroke-width: 1; }
.sp-chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.sp-chart .bar { fill: var(--accent); }
.sp-chart .hit { fill: transparent; }
.sp-chart .col:hover .hit { fill: color-mix(in srgb, var(--accent) 8%, transparent); }
.sp-chart .col:hover .bar { filter: brightness(1.15); }
.stat-post { display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center; text-decoration: none; color: inherit; padding: 8px; border-radius: 10px; margin: 0 -8px; }
.stat-post:hover { background: var(--panel-2); }
.stat-post .thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--panel-2); display: grid; place-items: center; color: var(--muted); }
.stat-post .body { min-width: 0; }
.stat-post .meta { display: flex; gap: 6px; align-items: center; font-size: 12px; flex-wrap: wrap; }
.stat-post .cap { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-post .nums { display: grid; justify-items: end; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sp-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---------- Übersicht ---------- */
.ov-posts { display: grid; }
.ov-post { display: grid; grid-template-columns: 92px auto minmax(0, 1fr); gap: 14px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; font-size: 14px; }
.ov-post:first-child { border-top: 0; padding-top: 0; }
.ov-post .when { display: grid; font-size: 12px; color: var(--muted); line-height: 1.3; font-variant-numeric: tabular-nums; }
.ov-post .when b { font-size: 15px; color: var(--text); font-weight: 600; }
.ov-post .cap { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-post .cap .sub { display: block; font-size: 12px; }
.ov-post:hover .cap { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Mobil ---------- */
@media (max-width: 1100px) {
  .cal-wrap { grid-template-columns: 1fr; }
  .day-panel { position: static; }
}
@media (max-width: 900px) { .sp-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 800px) {
  .cal-cell { min-height: 54px; padding: 4px 2px; align-items: center; }
  .cal-cell .chip, .cal-cell .more { display: none; }
  .cal-cell .dots { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; }
  .cal-cell .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--c, var(--accent)); }
  .cal-cell .dots i.failed { background: var(--danger); }
  .cal-cell .dots i.review { background: var(--warn); }
  .cal-head div { padding: 6px 2px; text-align: center; font-size: 11px; }
  .social-editor .ed-foot .btn { flex: 1; }
  .social-editor .ed-foot .spacer { display: none; }
  .stat-post { grid-template-columns: 44px 1fr; }
  .stat-post .nums { grid-column: 2; justify-items: start; display: flex; gap: 8px; flex-wrap: wrap; }
}

/* ---------- Plattform-Zugänge (Einstellungen) ---------- */
.sp-platform { padding: 12px 14px; }
.sp-platform summary { cursor: pointer; list-style: none; gap: 10px; }
.sp-platform summary::-webkit-details-marker { display: none; }
.sp-platform summary .spacer { flex: 1; }
.sp-platform[open] summary { margin-bottom: 12px; }

/* ---------- Folien-Editor (Karussell) ---------- */
.slides-cta { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 16px; background: var(--panel-2); margin-bottom: 10px; }
.slides-cta > div { flex: 1; display: grid; gap: 2px; min-width: 0; }
dialog.editor.slides-dialog { width: min(1120px, 100%); }
.sl-body { grid-template-columns: minmax(0, 1fr) minmax(0, 420px); align-items: start; }
.sl-controls { display: grid; gap: 16px; min-width: 0; }
.sl-list { display: grid; gap: 10px; }
.sl-card { display: grid; gap: 8px; padding: 12px 14px 14px; border-radius: 16px; background: var(--panel-2); border: 1px solid transparent; cursor: text; }
.sl-card.on { border-color: var(--accent); background: var(--panel); }
.sl-card-head { display: flex; align-items: center; gap: 8px; }
.sl-card-head b { width: 26px; height: 26px; border-radius: 999px; display: grid; place-items: center; font-size: 13px; background: var(--accent); color: var(--accent-text); flex: none; }
.sl-card-head select { width: auto; padding: 5px 10px; font-size: 13px; border-radius: 999px; }
.sl-card-head .spacer { flex: 1; }
.sl-card textarea { resize: vertical; min-height: 72px; }
.social-editor textarea[data-opt$="first_comment"] { min-height: 64px; }
.sl-preview { position: sticky; top: 0; display: grid; gap: 12px; }
.sl-preview > canvas { width: auto; max-width: 100%; max-height: 64vh; height: auto; justify-self: center; border-radius: 18px; box-shadow: 0 0 0 1px var(--line); background: var(--panel-2); }
.sl-thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 2px; scrollbar-width: thin; }
.sl-thumbs canvas { width: 64px; height: auto; flex: none; border-radius: 8px; cursor: pointer; box-shadow: 0 0 0 1px var(--line); opacity: .7; transition: opacity .15s, box-shadow .15s; }
.sl-thumbs canvas:hover { opacity: 1; }
.sl-thumbs canvas.on { opacity: 1; box-shadow: 0 0 0 2px var(--accent); }
@media (max-width: 800px) {
  .sl-body { grid-template-columns: 1fr; }
  .sl-preview { position: static; order: -1; }
  .sl-preview > canvas { max-height: 46vh; width: auto; max-width: 100%; justify-self: center; }
}

/* ---------- Slots & Freigabe ---------- */
.review-note { background: color-mix(in srgb, var(--warn) 12%, var(--panel)); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.slot-picks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.slot-pick { gap: 8px; padding: 5px 10px; }
.slot-pick:disabled { opacity: .5; cursor: default; }
.slot-pick .slot-acc { display: inline-flex; gap: 3px; align-items: center; }
.slot-rules { display: grid; gap: 10px; }
.slot-rule { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--panel-2); }
.slot-rule input[type=time] { width: auto; padding: 7px 10px; background: var(--panel); }
.slot-rule .wd { display: inline-flex; gap: 3px; }
.slot-rule .wd button { font: inherit; font-size: 12px; font-weight: 500; width: 32px; height: 32px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); cursor: pointer; }
.slot-rule .wd button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.slot-rule .acc-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.free-slot { display: grid; grid-template-columns: auto auto 1fr auto; gap: 10px; align-items: center; width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px dashed color-mix(in srgb, var(--text) 22%, transparent); background: transparent; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; text-align: left; }
.free-slot:hover { border-color: var(--text); color: var(--text); }
.free-slot .time { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.free-slot .add { font-weight: 500; }
.free-dots { position: absolute; right: 6px; top: 8px; display: flex; gap: 2px; }
.free-dots i { width: 6px; height: 6px; border-radius: 50%; border: 1.5px solid var(--muted); }
.review-item { display: grid; gap: 8px; }
@media (max-width: 800px) {
  .slot-rule { grid-template-columns: auto 1fr auto; }
  .slot-rule .acc-pick { grid-column: 1 / -1; }
}
