/*
  Inscon UI component library
  Sections: tokens, reset, shell, typography, buttons, chips/badges,
  cards, forms, tabs, tables, dropzone/progress, modal/sheet, toast,
  calendar, composer/preview, utility states, responsive layouts, dark mode.
*/

:root {
  color-scheme: light;
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --text: #172033;
  --text-muted: #5b6578;
  --surface: #ffffff;
  --surface-subtle: #f5f7fb;
  --surface-raised: #ffffff;
  --border: #d7dce5;
  --border-strong: #aeb7c6;
  --focus: #5b5bd6;
  --accent: #3838b8;
  --accent-hover: #2f2f9a;
  --accent-soft: #ececff;
  --danger: #b42318;
  --danger-soft: #feeceb;
  --success: #187a45;
  --success-soft: #eaf7ef;
  --warning: #8a5a00;
  --warning-soft: #fff5d6;
  --orange: #b54e00;
  --orange-soft: #fff0e6;
  --blue: #235ec4;
  --blue-soft: #eaf1ff;
  --gray: #667085;
  --gray-soft: #eef1f5;
  --shadow: 0 10px 30px rgba(28, 39, 64, .08);
  --radius-sm: .5rem;
  --radius-md: .75rem;
  --radius-lg: 1rem;
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --sidebar: 16rem;
  --topbar: 4.25rem;
  --bottom-nav: 4.5rem;
  --client-pm: #efb500;
  --client-deal: #7a5af8;
  --instagram: #a436a8;
  --tiktok: #101828;
  --facebook: #2458c6;
  --linkedin: #0a66c2;
}

* { box-sizing: border-box; }
html { min-width: 360px; background: var(--surface-subtle); }
body { margin: 0; font-family: var(--font-sans); font-size: 16px; line-height: 1.5; color: var(--text); background: var(--surface-subtle); }
img, video { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, summary { outline: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { box-shadow: 0 0 0 3px rgba(91,91,214,.28); border-radius: var(--radius-sm); }
a { color: var(--accent); text-underline-offset: .16em; }
h1,h2,h3,p { margin-top: 0; }
h1 { font-size: clamp(1.55rem, 3vw, 2rem); line-height: 1.2; margin-bottom: .5rem; }
h2 { font-size: 1.15rem; line-height: 1.3; }
h3 { font-size: 1rem; line-height: 1.3; }
small, .muted { color: var(--text-muted); }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-6) 0; }
svg.icon { width: 1.1rem; height: 1.1rem; flex: 0 0 auto; fill: currentColor; }

.skip-link { position: fixed; left: 1rem; top: -4rem; z-index: 1000; padding: .65rem 1rem; background: var(--accent); color: #fff; border-radius: .5rem; }
.skip-link:focus { top: .75rem; }

.app-shell { min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 40; min-height: var(--topbar); display: flex; align-items: center; gap: .75rem; padding: .65rem 1rem; background: color-mix(in srgb, var(--surface) 94%, transparent); border-bottom: 1px solid var(--border); backdrop-filter: blur(14px); }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: var(--text); text-decoration: none; font-weight: 800; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: .6rem; background: var(--accent); color: #fff; font-weight: 900; }
.topbar-spacer { flex: 1; }
.icon-button { width: 2.5rem; height: 2.5rem; display: inline-grid; place-items: center; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; }
.avatar { width: 2.3rem; height: 2.3rem; border-radius: 999px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 800; }
.client-switch { display: flex; align-items: center; gap: .45rem; min-width: 0; }
.client-switch select { min-width: 0; max-width: 11rem; }
.client-dot { width: .6rem; height: 1.5rem; border-radius: 99px; background: var(--client-pm); }
.client-dot.dealfuchs { background: var(--client-deal); }
.desktop-nav { display: none; }
.side-nav { display: none; }
.mobile-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; height: var(--bottom-nav); display: grid; grid-template-columns: repeat(6, 1fr); gap: 0; background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
.mobile-nav a { min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .18rem; color: var(--text-muted); text-decoration: none; font-size: .68rem; font-weight: 650; }
.mobile-nav a[aria-current="page"] { color: var(--accent); }
.mobile-nav .nav-plus { margin-top: -.6rem; }
.mobile-nav .nav-plus .nav-icon { width: 2.65rem; height: 2.65rem; border-radius: 999px; background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: var(--shadow); }
.nav-icon { font-size: 1.1rem; }
.main { padding: 1rem 1rem calc(var(--bottom-nav) + 1.5rem); }
/* Umbruch ist Pflicht: Ohne `flex-wrap` stehen Titelblock und Aktionen auf
   dem Smartphone nebeneinander, überschreiten zusammen die Bildschirmbreite
   und erzeugen Querscrollen auf der ganzen Seite. `min-width: 0` erlaubt dem
   Titelblock zu schrumpfen — Flex-Elemente tun das sonst nicht unter ihre
   Inhaltsbreite. */
.page-head { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.page-head > :first-child { flex: 1 1 16rem; min-width: 0; }
.page-head .actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: .5rem; }
.page-title-row { display:flex; align-items:center; flex-wrap:wrap; gap:.6rem; }
.breadcrumbs { display:flex; gap:.4rem; flex-wrap:wrap; font-size:.86rem; color:var(--text-muted); margin-bottom:.45rem; }
.breadcrumbs a { color:inherit; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.75rem; padding: .62rem 1rem; border: 1px solid transparent; border-radius: .65rem; font-weight: 750; text-decoration: none; cursor: pointer; transition: .15s ease; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--border-strong); background: var(--surface-subtle); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger-ghost { background: var(--surface); color: var(--danger); border-color: #f3b7b1; }
.btn-ghost { background: transparent; color: var(--text); border-color: transparent; }
.btn-sm { min-height: 2.25rem; padding: .4rem .65rem; font-size: .88rem; }
.btn-block { width: 100%; }

.card { background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: 0 1px 2px rgba(28,39,64,.03); }
.card-body { padding: 1rem; }
.card-head { display:flex; align-items:flex-start; gap:.75rem; padding:1rem 1rem .75rem; border-bottom:1px solid var(--border); }
.card-head h2 { margin:0; }
.card-head .actions { margin-left:auto; }
.card-grid { display:grid; gap:1rem; }
.metric { padding: 1rem; }
.metric-label { color: var(--text-muted); font-size: .85rem; }
.metric-value { font-size: 1.65rem; font-weight: 800; letter-spacing: -.03em; margin: .15rem 0; }
.metric-sub { font-size: .82rem; color: var(--text-muted); }
.warning-card { border-left: 4px solid var(--warning); }
.danger-card { border-left: 4px solid var(--danger); }
.success-card { border-left: 4px solid var(--success); }

.chip, .badge { display:inline-flex; align-items:center; gap:.35rem; max-width:100%; border-radius:999px; font-size:.8rem; line-height:1; white-space:nowrap; }
.chip { padding:.4rem .58rem; border:1px solid var(--border); background:var(--surface); color:var(--text); }
.chip-client { border-left:3px solid var(--client-pm); }
.chip-dealfuchs { border-left:3px solid var(--client-deal); }
.platform-instagram { color: var(--instagram); }
.platform-tiktok { color: var(--tiktok); }
.platform-facebook { color: var(--facebook); }
.platform-linkedin { color: var(--linkedin); }
.badge { padding:.34rem .55rem; font-weight:750; }
.badge-draft { background:var(--gray-soft); color:#485467; }
.badge-planned { background:var(--blue-soft); color:#174d9e; }
.badge-working { background:var(--warning-soft); color:#6e4900; }
.badge-yourturn { background:var(--orange-soft); color:#8f3d00; }
.badge-published { background:var(--success-soft); color:#126336; }
.badge-failed { background:var(--danger-soft); color:#8e1b13; }
.badge-skipped { background:#f2f4f7; color:#7b8494; }

.form-grid { display:grid; gap:1rem; }
.field { display:grid; gap:.4rem; }
.field label, fieldset legend { font-weight:700; }
.field-hint { font-size:.82rem; color:var(--text-muted); }
.field-error { font-size:.82rem; color:var(--danger); }
input[type="text"], input[type="password"], input[type="email"], input[type="url"], input[type="date"], input[type="time"], input[type="number"], input[type="search"], textarea, select { width:100%; min-height:2.75rem; border:1px solid var(--border-strong); border-radius:.6rem; padding:.62rem .72rem; background:var(--surface); color:var(--text); }
textarea { min-height:7.5rem; resize:vertical; }
input[type="checkbox"], input[type="radio"] { width:1.15rem; height:1.15rem; accent-color:var(--accent); }
fieldset { border:1px solid var(--border); border-radius:.75rem; padding:1rem; margin:0; }
.check-row, .radio-row { display:flex; align-items:flex-start; gap:.6rem; }
.check-row + .check-row, .radio-row + .radio-row { margin-top:.7rem; }
.inline-fields { display:grid; gap:.75rem; }
.segmented { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.5rem; }
.segmented label { position:relative; }
.segmented input { position:absolute; opacity:0; pointer-events:none; }
.segmented span { display:flex; min-height:3rem; align-items:center; justify-content:center; padding:.6rem; text-align:center; border:1px solid var(--border); border-radius:.65rem; background:var(--surface); font-weight:700; cursor:pointer; }
.segmented input:checked + span { border-color:var(--accent); background:var(--accent-soft); color:var(--accent); box-shadow:0 0 0 1px var(--accent); }
.switch { display:flex; align-items:center; justify-content:space-between; gap:1rem; }
.switch-control { position:relative; display:inline-flex; width:3rem; height:1.65rem; flex:0 0 auto; }
.switch-control input { position:absolute; opacity:0; }
.switch-track { width:100%; height:100%; border-radius:999px; background:#98a2b3; border:1px solid transparent; cursor:pointer; }
.switch-track::after { content:""; display:block; width:1.25rem; height:1.25rem; margin:.14rem; border-radius:50%; background:#fff; transition:.18s ease; box-shadow:0 1px 2px rgba(0,0,0,.25); }
.switch-control input:checked + .switch-track { background:var(--accent); }
.switch-control input:checked + .switch-track::after { transform:translateX(1.3rem); }
.color-input { min-height:2.75rem; width:5rem; padding:.2rem; border:1px solid var(--border); background:var(--surface); border-radius:.55rem; }

.tabs { display:flex; gap:.35rem; overflow-x:auto; padding-bottom:.2rem; border-bottom:1px solid var(--border); margin-bottom:1rem; }
.tabs a, .tabs button { border:0; background:transparent; color:var(--text-muted); font-weight:750; padding:.7rem .8rem; border-bottom:2px solid transparent; white-space:nowrap; text-decoration:none; cursor:pointer; }
.tabs [aria-selected="true"], .tabs a[aria-current="page"] { color:var(--accent); border-bottom-color:var(--accent); }
[data-tab-panel][hidden] { display:none; }

.table-wrap { width:100%; overflow-x:auto; }
table { width:100%; border-collapse:collapse; }
th, td { padding:.78rem .75rem; text-align:left; border-bottom:1px solid var(--border); vertical-align:middle; }
th { font-size:.78rem; text-transform:uppercase; letter-spacing:.045em; color:var(--text-muted); }
.table-actions { display:flex; flex-wrap:wrap; gap:.4rem; }
.mobile-cards { display:grid; gap:.75rem; }
.list-row { display:grid; gap:.65rem; padding:1rem; border-bottom:1px solid var(--border); }
.list-row:last-child { border-bottom:0; }
.thumb { width:4rem; aspect-ratio:1; border-radius:.55rem; background:linear-gradient(135deg, var(--accent-soft), var(--surface-subtle)); border:1px solid var(--border); display:grid; place-items:center; overflow:hidden; font-size:.75rem; color:var(--text-muted); }

.dropzone { position:relative; border:2px dashed var(--border-strong); border-radius:var(--radius-lg); background:var(--surface-subtle); padding:1.4rem; text-align:center; }
.dropzone.is-dragover { border-color:var(--accent); background:var(--accent-soft); }
.dropzone input[type="file"] { width:100%; max-width:28rem; }
.media-sort { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.75rem; margin-top:1rem; }
.media-tile { position:relative; min-height:9rem; border:1px solid var(--border); border-radius:.75rem; padding:.65rem; background:var(--surface); cursor:grab; }
.media-tile[draggable="true"]:active { cursor:grabbing; }
.media-preview-box { min-height:6rem; display:grid; place-items:center; background:var(--surface-subtle); border-radius:.55rem; color:var(--text-muted); }
.progress { display:block; height:.7rem; width:100%; border:0; border-radius:999px; overflow:hidden; background:#e6e9ef; appearance:none; }
.progress::-webkit-progress-bar { background:#e6e9ef; border-radius:999px; }
.progress::-webkit-progress-value { background:var(--accent); border-radius:999px; }
.progress::-moz-progress-bar { background:var(--accent); border-radius:999px; }
.progress-label { margin-top:.35rem; font-size:.82rem; color:var(--text-muted); }

.toast-region { position:fixed; right:1rem; bottom:calc(var(--bottom-nav) + 1rem); z-index:90; display:grid; gap:.5rem; width:min(92vw, 24rem); }
.toast { display:flex; align-items:flex-start; gap:.65rem; padding:.8rem .9rem; border-radius:.7rem; background:#182230; color:#fff; box-shadow:var(--shadow); }
.toast button { margin-left:auto; border:0; background:transparent; color:#fff; cursor:pointer; }
.dialog { width:min(92vw, 34rem); border:1px solid var(--border); border-radius:1rem; padding:0; color:var(--text); background:var(--surface); box-shadow:var(--shadow); }
.dialog::backdrop { background:rgba(15,23,42,.48); }
.dialog-head, .dialog-body, .dialog-actions { padding:1rem; }
.dialog-head { border-bottom:1px solid var(--border); }
.dialog-actions { border-top:1px solid var(--border); display:flex; justify-content:flex-end; gap:.5rem; }

.dropdown { position:relative; }
.dropdown-menu { position:absolute; right:0; top:calc(100% + .35rem); z-index:70; min-width:14rem; padding:.35rem; border:1px solid var(--border); border-radius:.7rem; background:var(--surface); box-shadow:var(--shadow); }
.dropdown-menu[hidden] { display:none; }
.dropdown-menu a, .dropdown-menu button { display:flex; width:100%; gap:.5rem; align-items:center; padding:.65rem .7rem; border:0; border-radius:.5rem; background:transparent; color:var(--text); text-decoration:none; text-align:left; cursor:pointer; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background:var(--surface-subtle); }

.notice { display:flex; gap:.7rem; padding:.8rem .9rem; border:1px solid var(--border); border-radius:.7rem; background:var(--surface); }
.notice-warning { background:var(--warning-soft); border-color:#e8c56f; }
.notice-danger { background:var(--danger-soft); border-color:#efb1aa; }
.notice-success { background:var(--success-soft); border-color:#9ad1b1; }
.empty-state { text-align:center; padding:2.25rem 1rem; }
.empty-state .empty-icon { width:3rem; height:3rem; display:grid; place-items:center; border-radius:999px; background:var(--accent-soft); color:var(--accent); margin:0 auto 1rem; font-size:1.35rem; }
.skeleton { min-height:1rem; border-radius:.35rem; background:linear-gradient(90deg,#eef1f5 25%,#f8f9fb 37%,#eef1f5 63%); background-size:400% 100%; animation:skeleton 1.4s ease infinite; }
@keyframes skeleton { 0%{background-position:100% 50%} 100%{background-position:0 50%} }

.composer-mobile-tabs { display:flex; }
.composer-layout { display:grid; gap:1rem; }
@media (max-width: 1199px) { .is-mobile-hidden { display:none!important; } }
.composer-step { scroll-margin-top:calc(var(--topbar) + 1rem); }
.step-number { width:1.8rem; height:1.8rem; border-radius:999px; background:var(--accent-soft); color:var(--accent); display:grid; place-items:center; font-size:.8rem; font-weight:800; flex:0 0 auto; }
.step-title { display:flex; gap:.7rem; align-items:center; }
.format-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.65rem; }
.format-choice { position:relative; }
.format-choice input { position:absolute; opacity:0; }
.format-choice span { min-height:5.4rem; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:.35rem; padding:.7rem; border:1px solid var(--border); border-radius:.75rem; background:var(--surface); font-weight:750; cursor:pointer; }
.format-choice input:checked + span { border-color:var(--accent); box-shadow:0 0 0 1px var(--accent); background:var(--accent-soft); color:var(--accent); }
.channel-grid { display:flex; flex-wrap:wrap; gap:.55rem; }
.channel-check { position:relative; }
.channel-check input { position:absolute; opacity:0; }
.channel-check span { display:flex; align-items:center; gap:.45rem; padding:.55rem .7rem; border:1px solid var(--border); border-radius:999px; cursor:pointer; background:var(--surface); }
.channel-check input:checked + span { box-shadow:0 0 0 1px var(--accent); border-color:var(--accent); background:var(--accent-soft); }
.char-count { font-variant-numeric:tabular-nums; }
.preview-panel { position:sticky; top:calc(var(--topbar) + 1rem); align-self:start; }
.preview-frame { max-width:25rem; margin:0 auto; border:1px solid var(--border); background:var(--surface); border-radius:1rem; overflow:hidden; box-shadow:var(--shadow); }
.preview-phone-head { display:flex; gap:.55rem; align-items:center; padding:.7rem; border-bottom:1px solid var(--border); }
.preview-avatar { width:2rem; height:2rem; border-radius:50%; background:var(--client-pm); }
.preview-media { aspect-ratio:4/5; display:grid; place-items:center; background:linear-gradient(160deg,#172033,#5b5bd6); color:#fff; text-align:center; padding:2rem; }
.preview-media.reel, .preview-media.story { aspect-ratio:9/16; }
.preview-copy { padding:.8rem; }
.composer-sticky { position:sticky; bottom:calc(var(--bottom-nav) + .25rem); z-index:35; display:flex; gap:.5rem; justify-content:flex-end; padding:.75rem; margin-top:1rem; border:1px solid var(--border); border-radius:.8rem; background:color-mix(in srgb,var(--surface) 94%,transparent); backdrop-filter:blur(12px); box-shadow:var(--shadow); }

.calendar-toolbar { display:flex; flex-wrap:wrap; align-items:center; gap:.5rem; margin-bottom:1rem; }
.day-swipe-controls { display:flex; align-items:center; justify-content:space-between; gap:.5rem; margin-bottom:.75rem; }
.day-swipe-controls [data-day-label] { text-align:center; font-size:.84rem; font-weight:700; }
.month-grid { display:grid; grid-template-columns:repeat(7,minmax(7.2rem,1fr)); min-width:52rem; border:1px solid var(--border); border-radius:.8rem; overflow:hidden; }
.month-head { padding:.6rem; font-weight:750; text-align:center; background:var(--surface-subtle); border-right:1px solid var(--border); border-bottom:1px solid var(--border); }
.month-cell { min-height:7.2rem; padding:.5rem; background:var(--surface); border-right:1px solid var(--border); border-bottom:1px solid var(--border); }
.month-event, .month-slot { display:block; margin-top:.35rem; padding:.3rem .35rem; border-radius:.4rem; font-size:.72rem; background:var(--accent-soft); color:var(--accent); border-left:3px solid var(--client-pm); }
.month-event.failed { background:var(--danger-soft); color:var(--danger); border-left-color:var(--danger); }
.month-event.yourturn { background:var(--orange-soft); color:var(--orange); border-left-color:var(--orange); }
.month-slot { background:transparent; color:var(--text-muted); border:1px dashed var(--border-strong); }
.calendar-month { display:none; }
.calendar-day-list { display:grid; gap:.75rem; }
.calendar-day { background:var(--surface); border:1px solid var(--border); border-radius:.8rem; overflow:hidden; }
.calendar-day h2 { padding:.75rem 1rem; margin:0; border-bottom:1px solid var(--border); }
.calendar-entry { display:grid; grid-template-columns:4rem 1fr auto; gap:.65rem; align-items:start; padding:.75rem 1rem; border-bottom:1px solid var(--border); }
.calendar-entry:last-child { border-bottom:0; }
.calendar-entry[draggable="true"] { cursor:grab; }
.calendar-entry.is-dragging { opacity:.55; }
.free-slot { border:1px dashed var(--border-strong); border-radius:.65rem; padding:.65rem; color:var(--text-muted); background:transparent; }
.calendar-grid { display:grid; grid-template-columns:5rem repeat(7,minmax(8rem,1fr)); min-width:62rem; border:1px solid var(--border); border-radius:.8rem; overflow:hidden; }
.cal-cell { min-height:6rem; padding:.45rem; border-right:1px solid var(--border); border-bottom:1px solid var(--border); background:var(--surface); }
.cal-cell.head { min-height:auto; font-weight:750; background:var(--surface-subtle); }
.cal-time { color:var(--text-muted); font-size:.78rem; }
.cal-event { padding:.45rem .5rem; border-radius:.55rem; border-left:3px solid var(--accent); background:var(--accent-soft); font-size:.78rem; margin-bottom:.35rem; }
.cal-event.pm { border-left-color:var(--client-pm); }
.cal-event.deal { border-left-color:var(--client-deal); }

.activity { list-style:none; padding:0; margin:0; }
.activity li { display:grid; grid-template-columns:auto 1fr; gap:.65rem; padding:.7rem 0; border-bottom:1px solid var(--border); }
.activity li:last-child { border-bottom:0; }
.activity-dot { width:.65rem; height:.65rem; margin-top:.45rem; border-radius:50%; background:var(--accent); }
.week-strip { display:grid; grid-template-columns:repeat(7,1fr); gap:.35rem; }
.week-day { text-align:center; padding:.55rem .25rem; border:1px solid var(--border); border-radius:.55rem; background:var(--surface); font-size:.75rem; }
.week-day strong { display:block; font-size:1rem; }
.week-day.has-post { border-color:var(--accent); background:var(--accent-soft); }

.status-timeline { list-style:none; margin:0; padding:0; }
.status-timeline li { position:relative; padding:0 0 1rem 1.6rem; }
.status-timeline li::before { content:""; position:absolute; left:.3rem; top:.35rem; width:.55rem; height:.55rem; border-radius:50%; background:var(--success); }
.status-timeline li::after { content:""; position:absolute; left:.55rem; top:.95rem; bottom:0; width:1px; background:var(--border); }
.status-timeline li:last-child::after { display:none; }
.status-timeline li.failed::before { background:var(--danger); }
.log-error { font-family:var(--font-mono); font-size:.82rem; white-space:pre-wrap; color:var(--danger); background:var(--danger-soft); border:1px solid #efb1aa; border-radius:.6rem; padding:.75rem; }

/* Roher Text in Maschinenform: JSON-Payloads der Webhooks, DM-Vorschauen,
   Fehlerausgaben. Ein <pre> ohne diese Klasse bricht nicht um und schiebt
   auf dem Smartphone die ganze Seite seitwaerts (die Bottom-Navigation
   inklusive) - deshalb pre-wrap statt horizontalem Scrollen, und
   overflow-wrap:anywhere fuer die langen Token- und ID-Ketten ohne
   Leerzeichen. Die Hoehenbegrenzung haelt einen 400-Zeilen-Payload davon
   ab, alles darunter aus dem Blickfeld zu druecken. */
.code-block { margin:0; padding:.75rem; font-family:var(--font-mono); font-size:.82rem; line-height:1.45; white-space:pre-wrap; overflow-wrap:anywhere; color:var(--text); background:var(--surface-subtle); border:1px solid var(--border); border-radius:.6rem; max-height:24rem; overflow:auto; }

/* Einzelne `<code>`-Schnipsel (Webhook-URL, IG-User-ID, Dateinamen) sind
   lange Zeichenketten ohne Leerzeichen. Ohne Umbruchregel schieben sie auf
   dem Smartphone die ganze Seite zur Seite. */
code { font-family:var(--font-mono); font-size:.86em; overflow-wrap:anywhere; }

.media-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.75rem; }
.media-card { overflow:hidden; }
.media-card .media-visual { aspect-ratio:1; background:linear-gradient(140deg,var(--accent-soft),var(--surface-subtle)); display:grid; place-items:center; color:var(--text-muted); }
/* Auswaehlbare Variante: <label class="media-card card"> mit einem
   Kaestchen darin (Medienbibliothek im Composer, Beitragsauswahl im
   Kampagnenformular). Das Kaestchen bleibt bewusst sichtbar - es ist die
   verlaessliche Anzeige des Zustands und funktioniert auch dort, wo :has()
   nicht greift. Der Rahmen ist die Zugabe, nicht die Information. */
label.media-card { display:block; cursor:pointer; }
.media-card input[type="checkbox"], .media-card input[type="radio"] { accent-color:var(--accent); margin:.6rem 0 0 .6rem; }
.media-card:has(input:checked) { border-color:var(--accent); box-shadow:0 0 0 1px var(--accent); }
.media-card:has(input:focus-visible) { outline:2px solid var(--accent); outline-offset:2px; }
.channel-row { display:grid; gap:.65rem; padding:1rem; border-bottom:1px solid var(--border); }
.channel-row:last-child { border-bottom:0; }
.token-ok { color:var(--success); }
.token-warn { color:var(--warning); }
.token-bad { color:var(--danger); }
.dot { display:inline-block; width:.65rem; height:.65rem; border-radius:50%; background:currentColor; margin-right:.25rem; }
.schedule-grid { display:grid; grid-template-columns:4rem repeat(7, minmax(5rem,1fr)); min-width:48rem; }
.schedule-grid > div { border-right:1px solid var(--border); border-bottom:1px solid var(--border); padding:.45rem; min-height:3rem; background:var(--surface); }
.schedule-grid .head { font-weight:750; background:var(--surface-subtle); }
.schedule-slot { display:block; width:100%; padding:.35rem .25rem; border-radius:.4rem; background:var(--accent-soft); border:1px solid var(--accent); color:var(--accent); font-size:.76rem; }

.auth-shell { min-height:100vh; display:grid; place-items:center; padding:1.25rem; background:var(--surface-subtle); }
.auth-card { width:min(100%,28rem); }
.auth-brand { display:flex; justify-content:center; margin-bottom:1.25rem; }
.code-inputs { display:grid; grid-template-columns:repeat(6,1fr); gap:.35rem; }
.code-inputs input { text-align:center; font-size:1.35rem; padding:.35rem; }
.error-shell { min-height:70vh; display:grid; place-items:center; text-align:center; padding:2rem; }
.error-code { font-size:clamp(4rem,15vw,8rem); font-weight:900; color:var(--accent); letter-spacing:-.08em; }

.sr-only { position:absolute!important; width:1px!important; height:1px!important; padding:0!important; margin:-1px!important; overflow:hidden!important; clip:rect(0,0,0,0)!important; white-space:nowrap!important; border:0!important; }
.stack { display:grid; gap:1rem; }
.stack-sm { display:grid; gap:.5rem; }
/* Grid-Elemente haben `min-width: auto` und schrumpfen deshalb nie unter
   ihre Inhaltsbreite: Ein langer Text sprengt dann die Spur und mit ihr
   die Seite (Querscrollen auf dem Smartphone). */
.stack > *, .stack-sm > * { min-width: 0; }
.flex { display:flex; align-items:center; gap:.6rem; }
.flex-wrap { display:flex; align-items:center; flex-wrap:wrap; gap:.5rem; }
.justify-between { justify-content:space-between; }
.text-right { text-align:right; }
.w-full { width:100%; }
.mt-1 { margin-top:.5rem; }
.mt-2 { margin-top:1rem; }
.mb-0 { margin-bottom:0; }
.hidden { display:none!important; }

@media (max-width: 767px) {
  .dialog { width:100%; max-width:none; margin:auto 0 0; border-radius:1rem 1rem 0 0; border-bottom:0; }
  table.responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display:block; width:100%; }
  .responsive-table thead { display:none; }
  .responsive-table tr { margin-bottom:.75rem; padding:.7rem; border:1px solid var(--border); border-radius:.75rem; background:var(--surface); }
  .responsive-table td { display:grid; grid-template-columns:minmax(6.5rem,40%) 1fr; gap:.5rem; padding:.5rem 0; border-bottom:1px solid var(--border); }
  .responsive-table td:last-child { border-bottom:0; }
  .responsive-table td::before { content:attr(data-label); color:var(--text-muted); font-size:.78rem; font-weight:750; text-transform:uppercase; letter-spacing:.035em; }
}

@media (min-width: 768px) {
  .main { padding:1.25rem 1.5rem 2rem 5.9rem; }
  .mobile-nav { display:none; }
  .side-nav { display:flex; position:fixed; left:0; top:var(--topbar); bottom:0; z-index:30; width:4.6rem; flex-direction:column; align-items:center; gap:.4rem; padding:.8rem .45rem; border-right:1px solid var(--border); background:var(--surface); }
  .side-nav a { width:3.2rem; min-height:3.1rem; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:.15rem; border-radius:.65rem; color:var(--text-muted); text-decoration:none; font-size:.62rem; }
  .side-nav a[aria-current="page"] { background:var(--accent-soft); color:var(--accent); }
  .card-grid.cols-2 { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .card-grid.cols-3 { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .inline-fields { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .segmented { grid-template-columns:repeat(4,minmax(0,1fr)); }
  .format-grid { grid-template-columns:repeat(5,minmax(0,1fr)); }
  .media-sort { grid-template-columns:repeat(4,minmax(0,1fr)); }
  .media-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .calendar-day-list { display:none; }
  .day-swipe-controls { display:none; }
  .calendar-month { display:block; overflow-x:auto; }
  .toast-region { bottom:1rem; }
  .composer-sticky { bottom:1rem; }
}

@media (min-width: 1200px) {
  :root { --sidebar:16rem; }
  .topbar { padding-left:1.25rem; }
  .topbar .desktop-nav { display:none; }
  .side-nav { width:var(--sidebar); align-items:stretch; padding:.85rem; }
  .side-nav a { width:auto; min-height:2.7rem; flex-direction:row; justify-content:flex-start; padding:.55rem .7rem; gap:.7rem; font-size:.88rem; font-weight:650; }
  .side-nav .nav-label { display:inline; }
  .side-nav .create-link { background:var(--accent); color:#fff; margin-bottom:.5rem; }
  .main { padding:1.6rem 2rem 3rem calc(var(--sidebar) + 2rem); }
  .composer-mobile-tabs { display:none; }
  .composer-layout { grid-template-columns:minmax(0,1fr) 25rem; align-items:start; }
  .card-grid.cols-4 { grid-template-columns:repeat(4,minmax(0,1fr)); }
  .dashboard-grid { display:grid; grid-template-columns:minmax(0,1.5fr) minmax(20rem,.8fr); gap:1rem; }
  .media-grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
  .channel-row { grid-template-columns:2fr 1fr 1.2fr auto; align-items:center; }
}


:root[data-theme="dark"] {
  color-scheme: dark;
  --tiktok:#eef2f8;
  --text:#eef2f8; --text-muted:#a9b2c3; --surface:#111827; --surface-subtle:#0b1220; --surface-raised:#111827; --border:#293449; --border-strong:#46546b;
  --accent:#8b8cf4; --accent-hover:#a1a2ff; --accent-soft:#23244d; --danger:#ff7a70; --danger-soft:#3a1d20; --success:#5dd38d; --success-soft:#153224; --warning:#f2c14e; --warning-soft:#352a10;
  --orange:#ff9955; --orange-soft:#3a2114; --blue:#78a9ff; --blue-soft:#142743; --gray-soft:#212b3b; --shadow:0 14px 38px rgba(0,0,0,.28);
}
:root[data-theme="light"] { color-scheme:light; }


/* Light-first visual polish */
:root {
  --page-bg: #f8f9fd;
  --surface: #ffffff;
  --surface-subtle: #f7f8fc;
  --surface-raised: #ffffff;
  --border: #e4e7ef;
  --border-strong: #cbd2df;
  --text: #172033;
  --text-muted: #687386;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #f0efff;
  --shadow: 0 12px 34px rgba(37, 47, 74, .07);
}

html,
body {
  background: var(--page-bg);
}

body {
  background-image:
    radial-gradient(circle at 15% -10%, rgba(79,70,229,.055), transparent 26rem),
    radial-gradient(circle at 88% 2%, rgba(14,165,233,.035), transparent 24rem);
  background-attachment: fixed;
}

.topbar {
  background: rgba(255,255,255,.96);
  border-bottom-color: var(--border);
  box-shadow: 0 4px 18px rgba(37,47,74,.035);
}

.side-nav,
.mobile-nav {
  background: #ffffff;
}

.card {
  border-color: var(--border);
  background: #ffffff;
  box-shadow: 0 8px 28px rgba(37,47,74,.055);
}

.card:hover {
  box-shadow: 0 12px 34px rgba(37,47,74,.075);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 8px 18px rgba(79,70,229,.18);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary,
.icon-button,
.chip,
.dropdown-menu,
.dialog {
  background: #ffffff;
}

.hero-head {
  background: linear-gradient(135deg, #ffffff 0%, #fafaff 55%, #f5f7ff 100%);
  border: 1px solid #e7e8f3;
  border-radius: 1.2rem;
  box-shadow: 0 12px 36px rgba(37,47,74,.06);
  padding: 1.25rem;
}

.eyebrow {
  display: inline-block;
  margin-bottom: .5rem;
  color: var(--accent);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .075em;
  text-transform: uppercase;
}

.lead {
  max-width: 64ch;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 0;
}

.metric {
  background: #ffffff;
}

.warning-card,
.danger-card,
.success-card {
  background: #ffffff;
}

.warning-card { border-left-color: #d99a00; }
.danger-card { border-left-color: #d13c32; }
.success-card { border-left-color: #158a4e; }

.format-choice span,
.channel-check span,
.radio-row,
fieldset,
.dropzone,
.media-tile,
.preview-frame {
  background: #ffffff;
}

.dropzone {
  border-color: #cfd5e2;
  background: #fafbfe;
}

.preview-media {
  background: linear-gradient(145deg, #eef0ff, #dfe4ff);
  color: #252b45;
}

.composer-sticky {
  background: rgba(255,255,255,.96);
}

.tabs {
  background: #f7f8fc;
}

.tabs [aria-selected="true"],
.tabs a[aria-current="page"] {
  background: #ffffff;
}

@media (min-width: 768px) {
  .hero-head {
    padding: 1.5rem 1.6rem;
  }
}

:root[data-theme="dark"] {
  --page-bg:#0b1220;
}
:root[data-theme="dark"] html,
:root[data-theme="dark"] body {
  background:#0b1220;
}
:root[data-theme="dark"] body {
  background-image:none;
}

/* --- Beste Sendezeit (Kalender, Planen, Sendeplätze) ---------------------
   Die Markierung kommt serverseitig als data-Attribut; ohne diese Regeln
   bliebe sie ein nackter Textpunkt. Dezent halten: Entscheidungshilfe,
   kein Alarm. */
[data-beste-sendezeit] { color: var(--accent); }
.calendar-entry[data-beste-sendezeit] { border-color: var(--accent); }
.cal-time[data-beste-sendezeit] { font-weight: 750; }
[data-sendezeit-legende] { font-size: .86rem; }
.sendezeit-bild { max-width: 28rem; }
.sendezeit-bild svg { width: 100%; height: auto; display: block; color: var(--accent); }

/* --- Betriebs-Banner (Not-Aus, Worker-Watchdog) --------------------------
   Klebt unter der Topbar, damit die Warnung beim Scrollen sichtbar bleibt —
   wer den Not-Aus zieht, darf ihn nicht aus den Augen verlieren. z-Index
   unter der Topbar (40), über dem Inhalt. */
.betriebs-banner { position: sticky; top: var(--topbar); z-index: 35; margin: 0; border-radius: 0; }
