/* ============================================================
   Factsheet Six — Dashboard v2
   Mobile-first sidebar layout
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #1a1a1a;
    background: #f4f4f4;
    line-height: 1.5;
}

a { color: #c94a2b; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ────────────────────────────────────────────────── */

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

/* ── Mobile top bar ────────────────────────────────────────── */

.mobile-bar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 200;
    display: flex; align-items: center; gap: .75rem;
    padding: .75rem 1rem;
    background: #fff; border-bottom: 1px solid #e5e5e5;
    height: 52px;
}

.mobile-brand {
    font-weight: 800; font-size: 1rem; color: #1a1a1a;
    flex: 1; letter-spacing: -.02em;
}
.mobile-brand:hover { text-decoration: none; }

.mobile-logout { font-size: .8rem; color: #999; white-space: nowrap; }

/* ── Hamburger ─────────────────────────────────────────────── */

.hamburger {
    background: none; border: none; cursor: pointer;
    padding: .3rem; display: flex; flex-direction: column;
    gap: 5px; flex-shrink: 0;
}

.hamburger span {
    display: block; width: 22px; height: 2px; background: #333;
    transition: transform .2s ease, opacity .2s ease;
    transform-origin: center;
}

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Overlay ───────────────────────────────────────────────── */

.overlay {
    display: none; position: fixed; inset: 0; z-index: 99;
    background: rgba(0,0,0,.4);
    cursor: pointer;
}
.overlay.active { display: block; }

/* ── Sidebar ───────────────────────────────────────────────── */

.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 240px; z-index: 100;
    background: #fff; border-right: 1px solid #e5e5e5;
    overflow-y: auto; display: flex; flex-direction: column;
    transform: translateX(-100%);
    transition: transform .25s ease;
}

.sidebar.open { transform: translateX(0); }

.sidebar-inner {
    display: flex; flex-direction: column;
    min-height: 100%; padding: 1rem;
}

/* Brand */
.sidebar-brand {
    padding: .75rem 0 1rem;
    border-bottom: 1px solid #eee;
    margin-bottom: .75rem;
}

.brand-link {
    font-weight: 800; font-size: 1.05rem;
    color: #1a1a1a; letter-spacing: -.02em;
}
.brand-link:hover { text-decoration: none; color: #c94a2b; }

/* Top nav row (Dashboard | Admin | Account | FR | Log out) */
.sidebar-top-nav {
    display: flex; flex-wrap: wrap; gap: .2rem .6rem;
    font-size: .78rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid #eee;
    margin-bottom: .75rem;
}

.top-nav-link { color: #555; }
.top-nav-link:hover { color: #c94a2b; text-decoration: none; }
.top-nav-link.active { color: #c94a2b; font-weight: 600; }
.top-nav-link.lang { font-weight: 700; color: #1a1a1a; }

/* Section heading */
.nav-heading {
    font-size: .62rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .09em;
    color: #bbb; margin: .25rem 0 .2rem;
}
.nav-heading-label {
    display: block;
}

/* Publication name link below DASHBOARD label */
.nav-publication-name {
    font-size: .95rem; font-weight: 700;
    color: #1a1a1a; padding: .2rem .5rem .35rem;
}
.nav-publication-name:hover { background: #f5f5f5; text-decoration: none; color: #c94a2b; }

.nav-section {
    margin-top: .75rem;
}

.nav-section-title {
    font-size: .62rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .09em;
    color: #bbb; margin-bottom: .25rem;
}

/* Nav links */
.nav-link {
    display: flex; align-items: center; gap: .4rem;
    padding: .32rem .5rem; border-radius: 5px;
    font-size: .875rem; color: #333;
    transition: background .12s;
    position: relative;
}
.nav-link:hover { background: #f5f5f5; text-decoration: none; color: #1a1a1a; }
.nav-link.active { background: #fef2f0; color: #c94a2b; font-weight: 600; }

.nav-sub {
    padding-left: 1.1rem;
    font-size: .82rem; color: #666;
}

/* View site link */
.nav-view-site {
    font-size: .82rem; color: #888;
    display: block; padding: .3rem .5rem;
    margin-bottom: .25rem;
}
.nav-view-site:hover { color: #c94a2b; text-decoration: none; }

/* Badge (draft count etc.) */
.badge {
    margin-left: auto;
    font-size: .68rem; background: #eee; color: #666;
    padding: 1px 6px; border-radius: 10px;
    font-weight: 600;
}

/* Upgrade to Pro */
.nav-upgrade {
    display: flex; align-items: center; justify-content: center;
    margin: 1rem 0 .5rem;
    padding: .5rem 1rem;
    background: #c94a2b; color: #fff !important;
    font-weight: 700; font-size: .85rem;
    border-radius: 6px;
    text-align: center;
}
.nav-upgrade:hover { background: #b0401f; text-decoration: none; }

/* Sidebar footer */
.sidebar-footer {
    margin-top: auto;
    padding-top: 1.25rem;
    font-size: .7rem; color: #bbb; line-height: 1.7;
}
.sidebar-footer a { color: #bbb; }
.sidebar-footer a:hover { color: #888; text-decoration: none; }

/* ── Main content ──────────────────────────────────────────── */

.main {
    flex: 1; min-width: 0;
    padding: calc(52px + 1.25rem) 1rem 3rem;
}

/* ── Dashboard header ──────────────────────────────────────── */

.dash-header {
    display: flex; flex-direction: column; gap: .75rem;
    margin-bottom: 1.25rem;
}

.nl-title {
    font-size: 1.6rem; font-weight: 800;
    letter-spacing: -.03em; line-height: 1.15;
}

.nl-select {
    font-size: 1.5rem; font-weight: 800;
    letter-spacing: -.03em; line-height: 1.15;
    border: none; background: transparent;
    cursor: pointer; padding: 0; color: #1a1a1a;
    max-width: 100%;
}
.nl-select:focus { outline: 2px solid #c94a2b; outline-offset: 2px; border-radius: 3px; }

.nl-subtitle {
    display: block; font-size: .85rem; color: #888;
    margin-top: .15rem;
}

.period-selector { display: flex; gap: .35rem; flex-wrap: wrap; }

.period-btn {
    padding: .28rem .65rem;
    border-radius: 20px; font-size: .78rem;
    color: #666; border: 1px solid #ddd; background: #fff;
    transition: background .12s, color .12s;
}
.period-btn:hover { background: #f5f5f5; text-decoration: none; }
.period-btn.active {
    background: #1a1a1a; color: #fff;
    border-color: #1a1a1a;
}

/* ── Stat cards ────────────────────────────────────────────── */

.stat-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .65rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: #fff; border: 1px solid #e5e5e5;
    border-radius: 10px; padding: 1rem;
}

.stat-label {
    font-size: .62rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .09em;
    color: #aaa; margin-bottom: .35rem;
}

.stat-value {
    font-size: 1.9rem; font-weight: 800;
    letter-spacing: -.04em; line-height: 1;
}

.stat-sub { font-size: .75rem; color: #999; margin-top: .3rem; }

/* ── Cards ─────────────────────────────────────────────────── */

.card {
    background: #fff; border: 1px solid #e5e5e5;
    border-radius: 10px; padding: 1.25rem;
    margin-bottom: .85rem;
}

.card-title {
    font-size: .95rem; font-weight: 700;
    margin-bottom: .75rem;
}

.card-sub {
    font-size: .8rem; color: #888;
    margin-top: -.4rem; margin-bottom: .75rem;
}

.card-header-row {
    display: flex; flex-wrap: wrap;
    align-items: baseline; gap: .4rem 1rem;
    margin-bottom: .75rem;
}
.card-header-row .card-title { margin-bottom: 0; }

.card-stats {
    display: flex; gap: .6rem;
    font-size: .76rem; color: #999;
    flex-wrap: wrap;
}

/* Two-column card row (post performance + best day) */
.card-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: .85rem;
}

/* ── Tables ────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }

.data-table {
    width: 100%; border-collapse: collapse;
    font-size: .82rem;
}

.data-table th {
    text-align: left;
    font-size: .62rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .07em;
    color: #aaa; padding: .45rem .4rem;
    border-bottom: 1px solid #eee;
}

.data-table td {
    padding: .55rem .4rem;
    border-bottom: 1px solid #f5f5f5;
    vertical-align: top;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table a { color: #1a1a1a; font-weight: 500; }
.data-table a:hover { color: #c94a2b; }

.post-date { font-size: .71rem; color: #bbb; margin-top: .1rem; }

/* Retention colour coding */
.good { color: #16a34a; font-weight: 600; }
.ok   { color: #d97706; font-weight: 600; }
.bad  { color: #c94a2b; font-weight: 600; }
.muted { color: #aaa; }

/* ── Empty state ───────────────────────────────────────────── */

.empty-state {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 1.25rem;
    min-height: 50vh;
    text-align: center;
}

.empty-state h2 { font-size: 1.2rem; color: #555; }

.btn-primary {
    display: inline-block;
    padding: .6rem 1.25rem;
    background: #c94a2b; color: #fff;
    border-radius: 6px; font-weight: 600; font-size: .9rem;
}
.btn-primary:hover { background: #b0401f; text-decoration: none; }

/* ── Desktop breakpoint ────────────────────────────────────── */

@media (min-width: 1024px) {
    .mobile-bar  { display: none; }
    .hamburger   { display: none; }
    .overlay     { display: none !important; }

    .sidebar {
        position: sticky; top: 0;
        height: 100vh; flex-shrink: 0;
        transform: translateX(0);
    }

    .main {
        padding: 2rem 2.5rem 3rem;
    }

    .dash-header {
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
    }

    .stat-cards { grid-template-columns: repeat(4, 1fr); }

    .card-row { grid-template-columns: 3fr 2fr; }
}

@media (min-width: 640px) and (max-width: 1023px) {
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
    .card-row   { grid-template-columns: 1fr 1fr; }
}

/* ── Write link badge ──────────────────────────────────────── */

.nav-write-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px;
    background: #c94a2b; color: #fff;
    border-radius: 50%; font-size: .65rem; font-weight: 800;
    line-height: 1; flex-shrink: 0;
}

/* ── Editor ────────────────────────────────────────────────── */

.editor-wrap {
    display: flex; flex-direction: column;
    min-height: calc(100vh - 52px);
}

.editor-toolbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; gap: .5rem;
    padding: .6rem 2rem;
    background: #fff; border-bottom: 1px solid #e5e5e5;
}

.editor-toolbar-left  { display: flex; align-items: center; gap: .5rem; flex: 1; }
.editor-toolbar-right { display: flex; align-items: center; gap: .5rem; margin-left: auto; flex-shrink: 0; }

.editor-back {
    font-size: .82rem; color: #888;
    padding: .3rem .5rem; border-radius: 4px;
}
.editor-back:hover { color: #c94a2b; text-decoration: none; background: #f5f5f5; }

.toolbar-sep { width: 1px; height: 18px; background: #e5e5e5; flex-shrink: 0; }

.btn-meta {
    padding: .3rem .75rem;
    font-size: .82rem; color: #555;
    border: 1px solid #ddd; border-radius: 4px;
    background: #fff; cursor: pointer;
}
.btn-meta:hover { background: #f5f5f5; }
.btn-meta.active { background: #f5f5f5; border-color: #bbb; }

.btn-save-draft {
    padding: .45rem 1.1rem;
    font-size: .85rem; color: #444;
    border: 1px solid #bbb; border-radius: 6px;
    background: #fff; cursor: pointer; font-weight: 500;
    font-family: inherit;
    transition: background .15s, border-color .15s;
}
.btn-save-draft:hover { background: #f5f5f5; border-color: #999; }

.btn-post {
    padding: .45rem 1.25rem;
    font-size: .85rem; color: #fff;
    border: none; border-radius: 6px;
    background: #c94a2b; cursor: pointer; font-weight: 700;
    font-family: inherit;
    letter-spacing: .01em;
    transition: background .15s;
}
.btn-post:hover { background: #b0401f; }

/* Metadata panel */
.meta-panel {
    background: #f9f9f9;
    border-bottom: 1px solid #e5e5e5;
    padding: 1.25rem 2rem;
    display: none;
}
.meta-panel.open { display: block; }
.meta-panel-inner { max-width: 700px; }
.meta-panel p { font-size: .78rem; color: #999; margin-top: .75rem; }
.meta-panel a { color: #c94a2b; }

.meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
}

.meta-field { display: flex; flex-direction: column; gap: .25rem; }
.meta-field.full { grid-column: 1 / -1; }

.meta-label {
    font-size: .7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .07em; color: #999;
}

.meta-input {
    padding: .4rem .6rem;
    border: 1px solid #ddd; border-radius: 4px;
    font-size: .875rem; background: #fff;
    font-family: inherit;
}
.meta-input:focus { outline: 2px solid #c94a2b; outline-offset: 0; border-color: transparent; }

.meta-hint { font-size: .72rem; color: #bbb; }

.meta-check { display: flex; align-items: center; gap: .5rem; font-size: .875rem; cursor: pointer; }
.meta-check input { accent-color: #c94a2b; }

/* Writing surface */
.editor-surface {
    background: #fff;
    box-shadow: 0 1px 6px rgba(0,0,0,.06);
    margin: 2rem 3rem 3rem;
    padding: 3rem 4rem;
    border-radius: 6px;
    flex: 1;
}

.editor-title-input {
    width: 100%; border: none; outline: none;
    font-size: 2rem; font-weight: 800;
    letter-spacing: -.03em; line-height: 1.2;
    color: #1a1a1a;
    border-bottom: 1px solid #eee;
    padding-bottom: .75rem; margin-bottom: .75rem;
    font-family: inherit; background: transparent;
}
.editor-title-input::placeholder { color: #ddd; }

.editor-subtitle-input {
    width: 100%; border: none; outline: none;
    font-size: 1.1rem; color: #888; line-height: 1.4;
    padding-bottom: .75rem; margin-bottom: 1.25rem;
    border-bottom: 1px solid #eee;
    font-family: inherit; background: transparent;
}
.editor-subtitle-input::placeholder { color: #ddd; }

/* Quill overrides within surface */
.editor-surface .ql-toolbar {
    border: none !important;
    border-bottom: 1px solid #eee !important;
    background: transparent;
    margin: 0 -4rem;
    padding: .5rem 4rem;
}
.editor-surface .ql-container { border: none !important; font-size: 1rem; font-family: inherit; }
.editor-surface .ql-editor { min-height: 300px; padding: 1rem 0; }
.editor-surface .ql-editor.ql-blank::before { color: #ddd; font-style: normal; left: 0; }

/* Flash message in editor */
.editor-flash { padding: .5rem 2rem; font-size: .82rem; text-align: center; }
.editor-flash.success { background: #f0fdf4; color: #16a34a; }
.editor-flash.error   { background: #fef2f2; color: #dc2626; }

@media (max-width: 1023px) {
    .editor-toolbar { padding: .6rem 1rem; }
    .editor-surface { margin: 1rem; padding: 1.5rem; }
    .editor-surface .ql-toolbar { margin: 0 -1.5rem; padding: .5rem 1.5rem; }
    .meta-panel { padding: 1rem; }
    .meta-grid  { grid-template-columns: 1fr; }
}

/* ── Posts flash banner ─────────────────────────────────────── */

.posts-flash {
    margin: 0 0 1.1rem;
    padding: .65rem 1.1rem;
    background: #f0faf3;
    border: 1px solid #b7e4c7;
    border-radius: 7px;
    font-size: .88rem; color: #1a6b35;
    font-weight: 500;
}

/* ── Posts listing page ─────────────────────────────────────── */

/* Page header: "Posts" title + Write button */
.posts-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1.25rem;
}
.posts-title {
    font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em;
}

.btn-write {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .45rem 1rem;
    background: #2563eb; color: #fff !important;
    border-radius: 6px; font-size: .875rem; font-weight: 600;
}
.btn-write:hover { background: #1d4ed8; text-decoration: none; }
.btn-write-caret { font-size: .7rem; opacity: .75; }

/* Tab bar */
.posts-tabs-bar {
    display: flex; align-items: stretch;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px 8px 0 0;
    padding: 0 .5rem;
}
.posts-tab-left { display: flex; align-items: stretch; flex: 1; overflow-x: auto; }
.posts-tab-right {
    display: flex; align-items: center; gap: .5rem;
    flex-shrink: 0; padding: .45rem 0 .45rem .5rem;
    border-left: 1px solid #f0f0f0; margin-left: .5rem;
}

.tab-link {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .7rem .85rem;
    font-size: .82rem; color: #666;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color .12s, border-color .12s;
}
.tab-link:hover { color: #1a1a1a; text-decoration: none; }
.tab-link.active { color: #1a1a1a; font-weight: 600; border-bottom-color: #1a1a1a; }

.tab-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px;
    background: #eee; color: #666;
    font-size: .65rem; font-weight: 700;
    border-radius: 9px; padding: 0 4px;
}
.tab-link.active .tab-count { background: #1a1a1a; color: #fff; }

.btn-filter {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .28rem .65rem;
    border: 1px solid #ddd; border-radius: 4px;
    font-size: .75rem; color: #555; background: #fff;
    cursor: pointer; text-decoration: none;
}
.btn-filter:hover { background: #f5f5f5; text-decoration: none; }

.sort-select {
    font-size: .75rem; color: #555;
    border: 1px solid #ddd; border-radius: 4px;
    padding: .28rem .5rem;
    background: #fff; cursor: pointer; font-family: inherit;
}
.sort-select:focus { outline: 2px solid #c94a2b; outline-offset: 0; }

/* Post list container */
.posts-list {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-top: none;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
}

/* Month group heading */
.posts-month-heading {
    padding: .5rem 1.25rem;
    font-size: .65rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .1em;
    color: #bbb; background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
}

/* Individual post item */
.post-item {
    display: flex; align-items: center; gap: 1rem;
    padding: .9rem 1.25rem;
    border-bottom: 1px solid #f5f5f5;
    transition: background .1s;
}
.post-item:last-child { border-bottom: none; }
.post-item:hover { background: #fafafa; }

/* Thumbnail */
.post-thumb {
    width: 52px; height: 52px;
    border-radius: 5px; flex-shrink: 0;
    object-fit: cover;
}
.post-thumb-placeholder {
    width: 52px; height: 52px;
    border-radius: 5px; flex-shrink: 0;
    background: #e8e8e8;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; font-weight: 800; color: #ccc;
    text-transform: uppercase;
}

/* Post info column */
.post-info { flex: 1; min-width: 0; }

.post-item-title {
    display: block;
    font-size: .9rem; font-weight: 700;
    color: #1a1a1a; line-height: 1.3;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.post-item-title:hover { color: #c94a2b; text-decoration: none; }

.post-item-meta {
    display: flex; align-items: center; gap: .45rem;
    margin-top: .2rem; flex-wrap: wrap;
}
.post-byline   { font-size: .74rem; color: #888; }
.post-item-date { font-size: .74rem; color: #bbb; }

.post-paid-badge {
    display: inline-block;
    font-size: .58rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: .06em;
    background: #1a1a1a; color: #fff;
    padding: 1px 5px; border-radius: 3px;
    vertical-align: middle;
}

.post-icons { display: flex; align-items: center; gap: .3rem; font-size: .8rem; color: #ccc; }
.post-icon-btn {
    background: none; border: none; cursor: pointer;
    font-size: .8rem; color: #ccc; padding: 0;
    line-height: 1;
}
.post-icon-btn:hover { color: #c94a2b; }

/* Stats column */
.post-stats {
    display: flex; flex-direction: row;
    align-items: center; gap: 1.1rem;
    flex-shrink: 0;
}
.post-stat {
    display: flex; flex-direction: column;
    align-items: center; gap: .05rem;
    text-align: center;
}
.post-stat-value { font-size: .82rem; font-weight: 700; color: #1a1a1a; line-height: 1.2; }
.post-stat-label {
    font-size: .58rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .07em; color: #bbb;
    white-space: nowrap;
}

/* Actions column */
.post-actions { display: flex; align-items: center; gap: .2rem; flex-shrink: 0; }

.btn-view-post {
    font-size: .78rem; color: #888;
    padding: .3rem .45rem; border-radius: 4px;
    white-space: nowrap;
}
.btn-view-post:hover { color: #c94a2b; background: #f5f5f5; text-decoration: none; }

/* More ... button + dropdown */
.post-more-wrap { position: relative; }

.btn-more {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 4px; font-size: 1rem; color: #bbb;
    cursor: pointer; background: none; border: none;
    letter-spacing: .05em;
}
.btn-more:hover { background: #f0f0f0; color: #555; }

.more-dropdown {
    display: none; position: absolute; right: 0; top: 110%;
    z-index: 300;
    background: #fff; border: 1px solid #e5e5e5;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
    min-width: 140px; overflow: hidden;
}
.more-dropdown.open { display: block; }
.more-dropdown a,
.more-dropdown button {
    display: block; width: 100%;
    padding: .5rem .85rem;
    font-size: .82rem; color: #333;
    text-align: left; background: none; border: none;
    cursor: pointer; font-family: inherit;
}
.more-dropdown a:hover,
.more-dropdown button:hover { background: #f5f5f5; text-decoration: none; color: #1a1a1a; }
.more-dropdown .danger        { color: #c94a2b; }
.more-dropdown .danger:hover  { background: #fef2f0; }

/* Pagination */
.posts-pagination {
    display: flex; justify-content: space-between;
    align-items: center;
    padding: .75rem 1.25rem;
    border-top: 1px solid #f0f0f0;
    font-size: .82rem;
}
.posts-pagination a {
    color: #555; padding: .3rem .65rem;
    border: 1px solid #ddd; border-radius: 4px;
    background: #fff;
}
.posts-pagination a:hover  { background: #f5f5f5; text-decoration: none; }
.pag-disabled { color: #ccc; cursor: default; border-color: #eee !important; background: #fafafa !important; }

/* Empty state inside list */
.posts-empty {
    padding: 3rem 1.25rem;
    text-align: center; color: #bbb; font-size: .9rem;
}
.posts-empty a { color: #c94a2b; }

/* Responsive: hide stats on small screens */
@media (max-width: 640px) {
    .post-stats { display: none; }
    .post-item  { gap: .65rem; }
    .post-thumb, .post-thumb-placeholder { width: 40px; height: 40px; font-size: 1rem; }
}

/* ============================================================
   Publish screen (test/post-publish.php)
   Distraction-free, no sidebar — full-width page
   ============================================================ */

.publish-wrap {
    min-height: 100vh;
    background: #f9f9f9;
    display: flex;
    flex-direction: column;
}

/* ── Toolbar ──────────────────────────────────────────────── */

.pub-toolbar {
    position: sticky; top: 0; z-index: 100;
    display: flex; align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem 1.5rem;
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    height: 52px;
}

.pub-back {
    font-size: .82rem; color: #888;
    white-space: nowrap;
}
.pub-back:hover { color: #1a1a1a; text-decoration: none; }

.pub-toolbar-actions {
    display: flex; align-items: center; gap: .75rem;
}

/* ── Buttons ──────────────────────────────────────────────── */

.pub-btn-cancel {
    font-size: .85rem; color: #888;
    padding: .4rem .9rem;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fff;
    white-space: nowrap;
    transition: background .15s, color .15s;
}
.pub-btn-cancel:hover { background: #f5f5f5; color: #1a1a1a; text-decoration: none; }

.pub-btn-submit {
    font-size: .88rem; font-weight: 600;
    color: #fff; background: #c94a2b;
    border: none; border-radius: 6px;
    padding: .45rem 1.1rem;
    cursor: pointer; white-space: nowrap;
    transition: background .15s;
}
.pub-btn-submit:hover { background: #b03e23; }

/* ── Body ─────────────────────────────────────────────────── */

.pub-body {
    max-width: 620px;
    margin: 2.5rem auto 4rem;
    padding: 0 1.25rem;
    width: 100%;
}

.pub-heading {
    font-size: 1.3rem; font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 2rem;
    line-height: 1.3;
}
.pub-post-title {
    display: block;
    font-size: 1rem; font-weight: 400; color: #666;
    margin-top: .25rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Errors ───────────────────────────────────────────────── */

.pub-errors {
    max-width: 620px; margin: 1rem auto 0;
    padding: 0 1.25rem;
}
.pub-errors p {
    background: #fef2f0; border: 1px solid #f5c6be;
    border-radius: 6px; padding: .6rem .9rem;
    color: #c94a2b; font-size: .85rem;
    margin-bottom: .5rem;
}

/* ── Sections ─────────────────────────────────────────────── */

.pub-section {
    display: flex; gap: 1rem;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    padding: 1.25rem 1.4rem;
    margin-bottom: 1.1rem;
}

.pub-section-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    margin-top: .1rem;
    line-height: 1;
}

.pub-section-body { flex: 1; min-width: 0; }

.pub-section-title {
    font-size: .92rem; font-weight: 700; color: #1a1a1a;
    margin-bottom: .9rem;
    text-transform: uppercase; letter-spacing: .04em;
}

/* ── Fieldset / legend ────────────────────────────────────── */

.pub-fieldset { border: none; padding: 0; margin: 0; }

.pub-legend {
    font-size: .78rem; font-weight: 600; color: #888;
    text-transform: uppercase; letter-spacing: .05em;
    margin-bottom: .6rem;
}

/* ── Radio group ──────────────────────────────────────────── */

.pub-radio-group {
    display: flex; flex-direction: column; gap: .5rem;
}

.pub-radio {
    display: flex; align-items: flex-start; gap: .7rem;
    padding: .65rem .9rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    background: #fafafa;
    transition: border-color .15s, background .15s;
}
.pub-radio:hover { border-color: #c94a2b; background: #fff; }
.pub-radio.selected {
    border-color: #c94a2b;
    background: #fff8f7;
}

.pub-radio input[type="radio"] {
    margin-top: .2rem; flex-shrink: 0;
    accent-color: #c94a2b;
}

.pub-radio-label {
    display: flex; flex-direction: column; gap: .15rem;
}
.pub-radio-label strong { font-size: .88rem; color: #1a1a1a; }
.pub-radio-label span   { font-size: .78rem; color: #888; }

/* ── Email toggle ─────────────────────────────────────────── */

.pub-email-toggle {
    display: flex; align-items: center; gap: .6rem;
    font-size: .88rem; color: #333;
    cursor: pointer;
    margin-bottom: 1rem;
}
.pub-email-toggle input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: #c94a2b; flex-shrink: 0;
}
.pub-email-toggle strong { color: #1a1a1a; }

.pub-email-fields { margin-top: .25rem; }

/* Post URL display */
.pub-post-url {
    display: flex; align-items: center; gap: .5rem;
    margin-top: .9rem;
    font-size: .78rem;
}
.pub-url-label {
    font-weight: 600; color: #888;
    text-transform: uppercase; letter-spacing: .05em;
    flex-shrink: 0;
}
.pub-url-link {
    color: #888; word-break: break-all;
    transition: color .15s;
}
.pub-url-link:hover { color: #c94a2b; }

.pub-no-subs {
    font-size: .8rem; color: #aaa;
    margin-top: .5rem;
    font-style: italic;
}

/* ── Fields ───────────────────────────────────────────────── */

.pub-field { margin-bottom: .9rem; }
.pub-field:last-child { margin-bottom: 0; }

.pub-label {
    display: block;
    font-size: .78rem; font-weight: 600; color: #555;
    margin-bottom: .3rem;
    text-transform: uppercase; letter-spacing: .04em;
}

.pub-input {
    display: block; width: 100%;
    padding: .5rem .75rem;
    font-size: .88rem; color: #1a1a1a;
    border: 1px solid #ddd; border-radius: 6px;
    background: #fff;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none; appearance: none;
}
.pub-input:focus {
    outline: none;
    border-color: #c94a2b;
    box-shadow: 0 0 0 2px rgba(201,74,43,.12);
}

.pub-hint {
    display: block;
    font-size: .74rem; color: #aaa;
    margin-top: .3rem;
}

/* ── Schedule row (date / time / tz inline) ───────────────── */

.pub-when-group { margin-bottom: .85rem; }

.pub-schedule-fields { margin-top: .75rem; }

.pub-schedule-row {
    display: flex; gap: .75rem; flex-wrap: wrap;
}
.pub-field-date { flex: 0 0 160px; }
.pub-field-time { flex: 0 0 110px; }
.pub-field-tz   { flex: 1 1 180px; min-width: 140px; }

.pub-schedule-note {
    font-size: .78rem; color: #888;
    margin-top: .5rem;
    font-style: italic;
}

/* ── Bottom actions ───────────────────────────────────────── */

.pub-actions-bottom {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid #eee;
}

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 600px) {
    .pub-toolbar { padding: .65rem 1rem; }
    .pub-body    { margin-top: 1.5rem; }
    .pub-section { padding: 1rem 1rem; flex-direction: column; gap: .6rem; }
    .pub-section-icon { font-size: 1rem; }
    .pub-schedule-row { flex-direction: column; }
    .pub-field-date, .pub-field-time, .pub-field-tz { flex: none; width: 100%; }
    .pub-actions-bottom { flex-direction: column-reverse; gap: .75rem; }
    .pub-btn-submit, .pub-btn-cancel { width: 100%; text-align: center; }
}

/* ── Fediverse interaction bar ─────────────────────────────── */

.ap-interact-bar {
    display: flex;
    gap: .45rem;
    margin-top: .65rem;
    padding-top: .65rem;
    border-top: 1px solid #f3f4f6;
    flex-wrap: wrap;
}
.ap-interact-btn {
    background: none;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 3px 11px;
    font-size: .76rem;
    color: #6b7280;
    cursor: pointer;
    line-height: 1.5;
    transition: background .15s, color .15s, border-color .15s;
}
.ap-interact-btn:hover {
    background: #f9fafb;
    color: #374151;
    border-color: #d1d5db;
}
.ap-like-btn.active  { background: #fef2f2; color: #c94a2b; border-color: #fca5a5; }
.ap-boost-btn.active { background: #f0fdf4; color: #16a34a; border-color: #86efac; }

/* ── Fediverse reply composer ──────────────────────────────── */

.ap-reply-box {
    display: block;
    margin-top: .5rem;
    width: 100%;
    box-sizing: border-box;
}
.ap-reply-text {
    display: block;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: .84rem;
    font-family: inherit;
    color: #111827;
    resize: vertical;
    outline: none;
    transition: border-color .15s;
}
.ap-reply-text:focus { border-color: #9ca3af; }
.ap-reply-actions {
    display: flex;
    gap: .5rem;
    margin-top: .4rem;
}
.ap-reply-send {
    background: #c94a2b;
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 5px 14px;
    font-size: .82rem;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s;
}
.ap-reply-send:hover:not(:disabled) { background: #b03d22; }
.ap-reply-send:disabled { opacity: .6; cursor: default; }
.ap-reply-cancel {
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    padding: 5px 12px;
    font-size: .82rem;
    cursor: pointer;
    color: #6b7280;
    font-family: inherit;
}
.ap-reply-cancel:hover { background: #f9fafb; }
