/* PinStudio – Oberfläche */

:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #fafbfc;
    --border: #e2e5ea;
    --text: #1c2024;
    --muted: #6b7480;
    --accent: #c8232c;
    --accent-dark: #a41d24;
    --ok: #157347;
    --ok-bg: #e7f4ed;
    --warn: #9a6700;
    --warn-bg: #fdf3d8;
    --err: #b42318;
    --err-bg: #fdeceb;
    --info-bg: #e8effb;
    --info: #1e4fa3;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

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

a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 600; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }

/* ---------- Grundgerüst ---------- */

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

.sidebar {
    width: 232px;
    flex: 0 0 232px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }

/* Menüknopf und Schließkreuz gehören zur schmalen Ansicht; am Schreibtisch
   steht das Menü ohnehin offen daneben. Das Umschalten übernimmt die
   Medienabfrage weiter unten. */
.nav-toggle, .nav-close, .nav-backdrop { display: none; }

.brand {
    display: flex; align-items: center; gap: .5rem;
    font-weight: 700; font-size: 1.05rem; color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-mark { font-size: 1.25rem; }

.sidebar nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
    display: flex; align-items: center; gap: .6rem;
    padding: .5rem .65rem;
    border-radius: 8px;
    color: var(--text);
    font-size: .92rem;
}
.nav-item:hover { background: var(--surface-2); text-decoration: none; }
.nav-item.is-active { background: #fdeaea; color: var(--accent); font-weight: 600; }
.nav-item svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.nav-group {
    font-size: .7rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--muted); font-weight: 700;
    margin: .75rem .65rem .15rem; padding-top: .6rem;
    border-top: 1px solid var(--border);
}

.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: .75rem; }
.sidebar-foot .user { font-size: .85rem; color: var(--muted); margin-bottom: .4rem; }

.main { flex: 1; min-width: 0; padding: 1.25rem 1.75rem 3rem; }
.topbar { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.topbar h1 { margin: 0; min-width: 0; }

/* ---------- Karten & Raster ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.1rem;
    margin-bottom: 1rem;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .85rem; }
.card-head h2 { margin: 0; }

/*
 * `minmax(0, 1fr)` statt `1fr`: eine Rasterspalte ist von sich aus mindestens
 * so breit wie ihr breitester unteilbarer Inhalt – bei einer Auswahlliste also
 * so breit wie der längste Eintrag darin, „Geschenkideen für Weihnachten“ zum
 * Beispiel. Auf dem Handy schob genau das die ganze Seite nach rechts aus dem
 * Bild. Die Null nimmt dieses Mindestmaß zurück; die Auswahllisten kürzen
 * ihren Text dann selbst.
 */
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
.grid-form { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
@media (max-width: 1100px) { .grid-form { grid-template-columns: minmax(0, 1fr); } }

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; }
.stat-value { font-size: 1.6rem; font-weight: 650; line-height: 1.1; }
.stat-label { font-size: .82rem; color: var(--muted); }

/* ---------- Formulare ---------- */

label { display: block; font-size: .86rem; font-weight: 600; margin-bottom: .3rem; }
.field { margin-bottom: .9rem; }
.hint { font-size: .8rem; color: var(--muted); font-weight: 400; margin-top: .25rem; }

input[type=text], input[type=url], input[type=password], input[type=search],
input[type=datetime-local], input[type=date], input[type=number], select, textarea {
    width: 100%;
    padding: .5rem .65rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    color: inherit;
    background: #fff;
}
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus {
    outline: 2px solid #c9d8f5; outline-offset: 0; border-color: #8fb0e8;
}
.row { display: flex; gap: .75rem; flex-wrap: wrap; }
/* `min-width: 0` aus demselben Grund wie beim Raster oben: ohne das schrumpft
   ein Feld nie unter die Breite seines längsten Auswahleintrags. */
.row > * { flex: 1 1 180px; min-width: 0; }

.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; font-size: .92rem; margin-bottom: 0; }
.check input { width: auto; margin: 0; }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .5rem .9rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit; font-weight: 600; font-size: .9rem;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { background: #10603a; }
.btn-danger { color: var(--err); border-color: #f2c4c0; }
.btn-danger:hover { background: var(--err-bg); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-small { padding: .3rem .6rem; font-size: .82rem; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ---------- Meldungen ---------- */

.flash-stack { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.flash {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
    padding: .6rem .85rem; border-radius: 8px; border: 1px solid transparent; font-size: .9rem;
}
.flash-success { background: var(--ok-bg); border-color: #b9dfc9; color: var(--ok); }
.flash-error { background: var(--err-bg); border-color: #f3c2be; color: var(--err); }
.flash-info { background: var(--info-bg); border-color: #c3d4f2; color: var(--info); }
.flash-close { background: none; border: 0; font-size: 1.1rem; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }
.flash-close:hover { opacity: 1; }

/* ---------- Tabellen ---------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .6rem .65rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
tbody tr:hover { background: var(--surface-2); }
td.nowrap, th.nowrap { white-space: nowrap; }

/* ---------- Status ---------- */

.badge {
    display: inline-block; padding: .15rem .5rem; border-radius: 999px;
    font-size: .75rem; font-weight: 600; white-space: nowrap;
    background: #eceef1; color: #4a525c;
}
.badge.draft { background: #eceef1; color: #4a525c; }
.badge.review { background: var(--warn-bg); color: var(--warn); }
.badge.approved { background: var(--info-bg); color: var(--info); }
.badge.publishing { background: #ede4fb; color: #6c3fc4; }
.badge.published { background: var(--ok-bg); color: var(--ok); }
.badge.partial { background: var(--warn-bg); color: var(--warn); }
.badge.failed { background: var(--err-bg); color: var(--err); }
.badge.cancelled { background: #eceef1; color: #8a919b; text-decoration: line-through; }
.badge.pinterest { background: #fdeaea; color: var(--accent); }
.badge.instagram { background: #f8e8f3; color: #ad3f86; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .4rem; }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--err); }

/* ---------- Bilder ---------- */

.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .6rem; }
.thumb {
    position: relative; border: 2px solid var(--border); border-radius: 8px; overflow: hidden;
    background: var(--surface-2); cursor: pointer; aspect-ratio: 3 / 4;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px #fdd; }
.thumb .thumb-badge {
    position: absolute; top: 4px; left: 4px;
    background: rgba(0,0,0,.65); color: #fff; font-size: .68rem;
    padding: .1rem .35rem; border-radius: 4px;
}
.thumb .thumb-check {
    position: absolute; top: 4px; right: 4px; width: 20px; height: 20px;
    border-radius: 50%; background: var(--accent); color: #fff;
    display: none; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700;
}
.thumb.is-selected .thumb-check { display: flex; }
.thumb-meta { font-size: .72rem; color: var(--muted); padding: .25rem .3rem; background: #fff; }

.dropzone {
    border: 2px dashed var(--border); border-radius: var(--radius);
    padding: 1.5rem 1rem; text-align: center; color: var(--muted);
    background: var(--surface-2); transition: .15s;
}
.dropzone.is-over { border-color: var(--accent); background: #fdf4f4; color: var(--accent); }
.dropzone strong { color: var(--text); }

.cover { width: 46px; height: 60px; object-fit: cover; border-radius: 5px; border: 1px solid var(--border); background: var(--surface-2); }
.cover-lg { width: 100%; border-radius: 8px; border: 1px solid var(--border); display: block; }

/* ---------- Sonstiges ---------- */

.muted { color: var(--muted); }
.small { font-size: .83rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.divider { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
.stack { display: flex; flex-direction: column; gap: .5rem; }
.inline-form { display: inline; }
.spinner {
    display: inline-block; width: 13px; height: 13px; border: 2px solid currentColor;
    border-right-color: transparent; border-radius: 50%; animation: spin .65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.target-list { display: flex; flex-direction: column; gap: .5rem; }
.target-row {
    display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
    padding: .5rem .6rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2);
}
.target-row select { flex: 1 1 180px; width: auto; min-width: 0; }
.target-row > .check { min-width: 0; }
.target-row .profile { font-size: .78rem; color: var(--muted); }

/* ---------- Login ---------- */

.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem; }
.auth-box { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 1.75rem; }
.auth-box .brand { justify-content: center; margin-bottom: 1.25rem; font-size: 1.2rem; }

/* ---------- ASIN-Modul ---------- */

/* Mehrfachauswahl in den Produktfiltern: kompakt, damit vier Listen
   nebeneinander passen, ohne die Seite zu sprengen. */
select[multiple] { padding: .3rem; font-size: .85rem; line-height: 1.5; }
select[multiple] option { padding: .1rem .25rem; border-radius: 4px; }

.flash-info { background: var(--info-bg); border-color: #c3d4f2; color: var(--info); }

/* ---------- Schmale Schirme: das Menü wird zur Schublade --------------- */

/*
 * Vorher stand das Menü als umbrechender Block über dem Inhalt. Bei siebzehn
 * Einträgen füllte das auf dem Handy den halben Bildschirm, und der eigentliche
 * Inhalt begann erst darunter. Jetzt liegt es neben dem Sichtfeld und kommt
 * über den Knopf in der Kopfzeile herein.
 *
 * Geöffnet wird über die Klasse `nav-open` am <body> (app.js). Nur eine Klasse
 * statt eines Stils am Element: dann steht der Zustand an einer Stelle, und die
 * Übergänge bleiben im Stylesheet.
 */
@media (max-width: 780px) {
    .main {
        padding: 1rem 1rem 3rem;
        padding-bottom: calc(3rem + env(safe-area-inset-bottom));
    }

    /* Die Kopfzeile bleibt stehen – der Menüknopf ist damit von überall auf
       der Seite erreichbar, auch mitten in einer langen Tabelle. */
    .topbar {
        position: sticky;
        top: 0;
        z-index: 20;
        margin: -1rem -1rem 1rem;
        padding: .5rem 1rem;
        padding-top: calc(.5rem + env(safe-area-inset-top));
        background: var(--surface);
        border-bottom: 1px solid var(--border);
    }
    .topbar h1 { font-size: 1.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    .nav-toggle {
        display: inline-flex; align-items: center; justify-content: center;
        flex: 0 0 auto;
        width: 40px; height: 40px; margin-left: -.4rem;
        padding: 0;
        background: none; border: 0; border-radius: 8px;
        color: var(--text); cursor: pointer;
    }
    .nav-toggle:active { background: var(--surface-2); }
    .nav-toggle svg {
        width: 24px; height: 24px;
        fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round;
    }

    .nav-close {
        display: block;
        width: 40px; height: 40px;
        padding: 0; margin-right: -.4rem;
        background: none; border: 0;
        font-size: 1.75rem; line-height: 1; color: var(--muted); cursor: pointer;
    }

    /* `visibility` schiebt die Schublade nicht nur aus dem Bild, sondern auch
       aus der Tabulatorreihenfolge – sonst wandert der Fokus in ein Menü, das
       niemand sieht. */
    .sidebar {
        position: fixed;
        top: 0; bottom: 0; left: 0;
        z-index: 45;
        width: 17rem; max-width: 84vw;
        flex: none; height: auto;
        padding-top: calc(1.25rem + env(safe-area-inset-top));
        padding-bottom: calc(1.25rem + env(safe-area-inset-bottom));
        box-shadow: 4px 0 24px rgba(16, 24, 40, .18);
        transform: translateX(-100%);
        visibility: hidden;
        transition: transform .22s ease, visibility .22s ease;
    }
    body.nav-open .sidebar { transform: none; visibility: visible; }

    .nav-backdrop {
        display: block;
        position: fixed; inset: 0;
        z-index: 40;
        background: rgba(16, 24, 40, .45);
        opacity: 0;
        visibility: hidden;
        transition: opacity .22s ease, visibility .22s ease;
    }
    body.nav-open .nav-backdrop { opacity: 1; visibility: visible; }

    /* Solange die Schublade offen ist, soll der Inhalt darunter nicht mitrollen. */
    body.nav-open { overflow: hidden; }

    /* Mit dem Daumen trifft man .5rem Polsterung schlecht; 40 Pixel sind das
       übliche Mindestmaß für eine Schaltfläche. */
    .nav-item { padding: .6rem .7rem; font-size: .98rem; }
    .btn { min-height: 40px; }
    .btn-small { min-height: 34px; }

    /* Etwas weniger Rand, damit der Inhalt die schmale Breite ausnutzt. */
    .card { padding: .9rem; }

    /* Überschrift und Abzeichen nebeneinander passen auf 360 Pixel nicht mehr. */
    .card-head { flex-wrap: wrap; gap: .4rem; }

    /* Kleinere Kacheln: bei 120 Pixel Mindestbreite bleiben auf schmalen
       Geräten zwei sehr große Bilder übrig, drei sind übersichtlicher. */
    .thumb-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .45rem; }

    /* Nichts darf breiter werden als der Schirm – sonst rutscht die ganze
       Seite zur Seite und lässt sich waagerecht schieben. */
    img, video, canvas, iframe { max-width: 100%; }
    .card, .flash, .dropzone, .panel { max-width: 100%; }

    /* Die Auswahlleiste der Beitragsübersicht klebt sonst unter der Kopfzeile:
       40px Knopf plus zweimal .5rem Polsterung ergeben deren Höhe. */
    .bulk-bar { top: 3.5rem; z-index: 2; }

    /* iOS zoomt beim Antippen jedes Feldes unter 16px hinein und kommt nicht
       von allein wieder heraus. */
    input[type=text], input[type=url], input[type=password], input[type=search],
    input[type=datetime-local], input[type=date], input[type=number], select, textarea {
        font-size: 16px;
    }
}

/* Ein Fenster kann breiter werden, ohne dass die Seite neu lädt – dann darf
   kein „offen“ hängen bleiben. Der Übergang stört beim Wechsel nur. */
@media (min-width: 781px) {
    body.nav-open { overflow: visible; }
}

/* ---------- Kalenderansichten der Vorplanung ---------- */

/* Woche: sieben gleich breite Spalten, die auf schmalen Schirmen scrollen
   statt zu Streifen zusammenzuschrumpfen. */
.cal-week {
    display: grid;
    grid-template-columns: repeat(7, minmax(150px, 1fr));
    gap: .5rem;
    overflow-x: auto;
    padding-bottom: .5rem;
}

.cal-col {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
    padding: .45rem;
    min-width: 0;
}
.cal-col.is-today { border-color: var(--accent); background: #fdf6f6; }

.cal-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: .3rem; margin-bottom: .2rem; font-size: .85rem;
}
.cal-head .check { margin: 0; }
.cal-meta { font-size: .72rem; color: var(--muted); margin-bottom: .4rem; }
.cal-empty { font-size: .8rem; color: var(--muted); text-align: center; padding: .5rem 0; }

.cal-item {
    background: #fff;
    border: 1px solid var(--border);
    border-left: 3px solid var(--border);
    border-radius: 6px;
    padding: .35rem .4rem;
    margin-bottom: .35rem;
    font-size: .78rem;
}
.cal-item-top { display: flex; align-items: center; gap: .3rem; margin-bottom: .25rem; flex-wrap: wrap; }
.cal-item-top .badge { font-size: .62rem; padding: .05rem .3rem; }
.cal-thumb { width: 100%; height: 70px; object-fit: cover; border-radius: 4px; display: block; margin-bottom: .25rem; }
.cal-title { line-height: 1.25; margin-bottom: .25rem; word-break: break-word; }
.cal-links { display: flex; gap: .4rem; flex-wrap: wrap; font-size: .72rem; }

/* Statusfarbe als linker Balken – erkennbar, ohne Fläche zu verbrauchen. */
.cal-review    { border-left-color: var(--warn); }
.cal-approved  { border-left-color: var(--info); }
.cal-published { border-left-color: var(--ok); }
.cal-cancelled { border-left-color: #b9bec6; }
.cal-draft     { border-left-color: #b9bec6; }

/* Als Link gestalteter Knopf – für Aktionen, die im Formular bleiben müssen. */
.linklike {
    background: none; border: 0; padding: 0; margin: 0;
    color: var(--info); font: inherit; font-size: inherit;
    cursor: pointer; text-decoration: none;
}
.linklike:hover { text-decoration: underline; }

/* Monat: festes Raster, jede Zelle ein Tag. */
.cal-month { table-layout: fixed; }
.cal-month th { text-align: center; font-size: .72rem; }
.cal-cell {
    vertical-align: top;
    height: 96px;
    padding: .25rem;
    border: 1px solid var(--border);
}
.cal-cell.is-outside { background: var(--surface-2); opacity: .6; }
.cal-cell.is-today { background: #fdf6f6; border-color: var(--accent); }
.cal-cell-head { display: flex; align-items: center; gap: .3rem; margin-bottom: .2rem; font-size: .8rem; }

.cal-mini {
    display: flex; align-items: center; gap: .25rem;
    font-size: .68rem; line-height: 1.4;
    border-left: 3px solid var(--border);
    padding-left: .25rem; margin-bottom: .1rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-mini input { margin: 0; }

@media (max-width: 780px) {
    .cal-cell { height: auto; min-height: 60px; }
}

/* ---------- Warteschlange: Fortschritt im Hintergrund ---------- */

.queue-bar {
    height: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: .3rem;
}
.queue-bar-fill {
    height: 100%;
    width: 0;
    background: var(--ok);
    transition: width .3s ease;
}

.queue-log {
    max-height: 190px;
    overflow-y: auto;
    margin: .6rem 0 0;
    padding: .4rem .6rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .76rem;
    line-height: 1.5;
}
.queue-log:empty { display: none; }
.queue-log-error { color: var(--err); }

/* --- Einklappbare Bereiche (z. B. die Mediathek im Beitragsformular) ----- */

.panel {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
}
.panel > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .6rem .8rem;
    cursor: pointer;
    font-weight: 600;
    font-size: .92rem;
    list-style: none;
    user-select: none;
}
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary::before {
    content: '▸';
    margin-right: .4rem;
    color: var(--muted);
    transition: transform .15s ease;
}
.panel[open] > summary::before { content: '▾'; }
.panel > summary:hover { background: #f1f3f5; border-radius: var(--radius) var(--radius) 0 0; }
.panel-body {
    padding: .8rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
    border-radius: 0 0 var(--radius) var(--radius);
}

/* --- Benutzerzeile in der Seitenleiste ---------------------------------- */

.sidebar-foot a.user { display: block; color: var(--text); }
.sidebar-foot a.user:hover { text-decoration: none; color: var(--accent); }
.sidebar-foot a.user .small { display: block; }

/* ---------- Vergrößerte Bildvorschau beim Überfahren ------------------- */

/* Frei schwebend statt in der Zelle vergrößert: die Tabellen stecken in
   einem Kasten mit overflow-x, dort würde ein herausgezoomtes Bild
   abgeschnitten. Die Quelle ist dieselbe wie im Vorschaubild – das Bild ist
   also schon im Zwischenspeicher des Browsers und erscheint ohne Warten. */
.zoom-preview {
    position: fixed;
    z-index: 60;
    padding: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(16, 24, 40, .22);
    pointer-events: none;
}
.zoom-preview img {
    display: block;
    width: 260px;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 6px;
}
.zoom-preview[hidden] { display: none; }

/* Ein kleiner Hinweis, dass da mehr zu sehen ist. */
img.zoomable { cursor: zoom-in; transition: box-shadow .12s ease; }
img.zoomable:hover { box-shadow: 0 0 0 2px var(--accent); }

/* ---------- Knopfleiste in Tabellenzeilen ------------------------------ */

.row-actions { flex-wrap: nowrap; gap: .3rem; }
.cal-links .linklike { font-size: inherit; }

td.num, th.num { text-align: right; }
.table-metrics td.num { font-variant-numeric: tabular-nums; }
.link-col { display: flex; flex-direction: column; gap: .15rem; }
.link-col > [data-platform-links] { display: flex; flex-direction: column; gap: .15rem; }
.metrics-at:empty { display: none; }

/* ---------- Kennzahlen ------------------------------------------------- */

.metric-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: .6rem;
}
.metric {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .6rem .7rem;
}
.metric-value { font-size: 1.4rem; font-weight: 650; line-height: 1.15; font-variant-numeric: tabular-nums; }
.metric-label { font-size: .78rem; color: var(--muted); }

.pin-metrics .card-head h2 { margin-bottom: .1rem; }

/* ---------- Schnellansicht (Modal) ------------------------------------- */

.modal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(16, 24, 40, .45); }
body.modal-open { overflow: hidden; }

.modal-box {
    position: relative;
    width: min(980px, 100%);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 16px 48px rgba(16, 24, 40, .28);
}

.modal-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
    padding: .9rem 1.1rem; border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; }
.modal-close { background: none; border: 0; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--muted); }
.modal-close:hover { color: var(--text); }

.modal-body { padding: 1.1rem; overflow-y: auto; flex: 1 1 auto; }

/* Links Bild, Zeitpunkt und Ziele – rechts die Texte. Auf schmalen Schirmen
   untereinander, sonst wären beide Spalten zu eng zum Schreiben. */
.modal-grid { display: grid; grid-template-columns: 320px 1fr; gap: 1.1rem; align-items: start; }
@media (max-width: 820px) { .modal-grid { grid-template-columns: 1fr; } }

.modal-grid .thumb-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
.modal-metrics { margin-top: 1rem; padding-top: .8rem; border-top: 1px solid var(--border); }

.modal-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    padding: .8rem 1.1rem; border-top: 1px solid var(--border); background: var(--surface-2);
    border-radius: 0 0 14px 14px;
}

@media (max-width: 780px) {
    .modal { padding: 0; }
    .modal-box { max-height: 100vh; border-radius: 0; width: 100%; }
    .modal-foot { border-radius: 0; }
}

/* ---------- Weg der Veröffentlichung ----------------------------------- */

/* „direkt“ hebt sich ab, „geplant“ bleibt zurückhaltend: der Regelfall
   braucht keine Aufmerksamkeit, die Ausnahme schon. */
.badge.via-manual { background: #ede4fb; color: #6c3fc4; }
.badge.via-scheduled { background: #eceef1; color: #4a525c; }

/* Löschen als Textlink in der Wochenansicht. */
.linklike.danger { color: var(--err); }

/* ---------- `hidden` muss überall greifen ------------------------------ */

/* Die Browser-Regel `[hidden] { display: none }` steht im UA-Stylesheet und
   verliert damit gegen jede Klasse, die display setzt – etwa `.btn` mit
   inline-flex. Genau daran hingen die Knöpfe „Freigeben“ und „Freigabe
   zurückziehen“, die abwechselnd ein- und ausgeblendet werden. */
[hidden] { display: none !important; }

/* ---------- Auswahl mehrerer Beiträge ---------------------------------- */

/* Schmal und ohne Umbruch: die Spalte trägt nur das Kästchen. */
th.pick, td.pick { width: 2rem; padding-right: 0; text-align: center; }
th.pick input, td.pick input { cursor: pointer; }

/*
 * Die Leiste erscheint erst mit der ersten Auswahl (hidden im Markup, das
 * Skript nimmt es weg) und bleibt beim Blättern durch eine lange Tabelle
 * sichtbar – sonst müsste man zum Handeln wieder nach oben scrollen.
 */
.bulk-bar {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .5rem;
    padding: .5rem .6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    box-shadow: var(--shadow);
}
.bulk-bar[hidden] { display: none; }

/* ---------- Teilen-Fenster (die Kurzfassung nach dem Teilen) ----------- */

/* Gedacht ist die Seite fürs Handy. Am Schreibtisch – etwa wenn jemand den
   Link im Browser teilt – soll sie deswegen nicht über die ganze Breite
   laufen: vier Kästen mit je zwei Feldern sähen dort verloren aus. */
#share-form { max-width: 44rem; }

/*
 * Bild und Titel nebeneinander wie im Seitenmenü der Erweiterung. Das Bild
 * ist die Kontrolle, dass der richtige Artikel angekommen ist – es gehört
 * deshalb ganz nach oben, darf den Titel aber nicht nach unten schieben.
 */
.share-product { display: flex; gap: .75rem; align-items: flex-start; }
.share-product .share-meta { flex: 1 1 auto; min-width: 0; }

.share-shot {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 84px;
    height: 84px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
}
.share-shot img { display: block; width: 100%; height: 100%; object-fit: contain; }
.share-shot-empty { font-size: 1.6rem; opacity: .35; }

/* Die Meldung steht direkt über dem Absende-Knopf – dorthin schaut man
   ohnehin, wenn man gerade darauf getippt hat. */
#share-result:not(:empty) { margin-bottom: .6rem; }

/* Der Ziel-Link ist lang; umbrechen darf er, die Seite seitwärts schieben
   lassen nicht. */
#link-preview { word-break: break-all; }
