:root {
    --bg: #0b0f14;
    --panel: #121923;
    --panel-2: #172231;
    --panel-3: #1e2b3b;
    --text: #e9f1ff;
    --muted: #8da0b8;
    --line: rgba(255,255,255,.09);
    --gold: #d7a64a;
    --cyan: #4bd7ff;
    --danger: #ff6b6b;
    --ok: #8dffb0;
    --shadow: 0 20px 60px rgba(0,0,0,.35);
    --radius: 18px;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(75,215,255,.16), transparent 28rem),
        radial-gradient(circle at bottom right, rgba(215,166,74,.14), transparent 32rem),
        var(--bg);
}

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

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px;
    background: linear-gradient(180deg, rgba(18,25,35,.98), rgba(11,15,20,.98));
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    z-index: 20;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 28px;
}

.brand-mark {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    overflow: hidden;
    background: transparent;
    flex-shrink: 0;
}

.brand-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    display: block;
}

.brand-title { font-weight: 800; font-size: 1.05rem; }
.brand-subtitle { color: var(--muted); font-size: .82rem; }

.side-nav { display: grid; gap: 8px; }
.side-nav a {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 12px 14px;
    border-radius: 14px;
    color: var(--muted);
    border: 1px solid transparent;
}
.side-nav a:hover,
.side-nav a.is-active {
    color: var(--text);
    background: rgba(255,255,255,.055);
    border-color: var(--line);
    text-decoration: none;
}
.side-nav a.is-active { box-shadow: inset 3px 0 0 var(--gold); }

.nav-icon{
    width:20px;
    height:20px;
    flex-shrink:0;
    opacity:.85;
    display:block;
}

.sidebar-footer { margin-top: auto; display: grid; gap: 12px; }
.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255,255,255,.04);
}
.avatar {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--panel-3);
    color: var(--gold);
    font-weight: 800;
}
.user-chip small { display: block; color: var(--muted); }
.logout-link { color: var(--muted); font-size: .92rem; }

.main-panel { min-width: 0; }
.topbar {
    min-height: 102px;
    padding: 24px 32px;
    display: flex;
    gap: 18px;
    align-items: center;
    border-bottom: 1px solid var(--line);
    background: rgba(11,15,20,.55);
    backdrop-filter: blur(14px);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar h1 { margin: 2px 0 0; font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1.05; }
.eyebrow { color: var(--gold); text-transform: uppercase; font-size: .75rem; letter-spacing: .18em; }
.menu-button {
    display: none;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--text);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 1.1rem;
}
.content-wrap { padding: 32px; max-width: 1240px; }

.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.card {
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(23,34,49,.92), rgba(18,25,35,.92));
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
}
.card h2, .card h3 { margin-top: 0; }
.muted { color: var(--muted); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    border: 0;
    border-radius: 13px;
    padding: 10px 15px;
    color: #081018;
    background: linear-gradient(135deg, var(--gold), #ffd98a);
    font-weight: 800;
    cursor: pointer;
}
.button.secondary {
    color: var(--text);
    background: rgba(255,255,255,.08);
    border: 1px solid var(--line);
}
.button:hover { text-decoration: none; filter: brightness(1.05); }

.table-card { overflow-x: auto; padding: 0; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--gold); font-size: .78rem; text-transform: uppercase; letter-spacing: .11em; }
tr:hover td { background: rgba(255,255,255,.035); }

.badge {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 4px 9px;
    color: var(--muted);
    background: rgba(255,255,255,.04);
    font-size: .82rem;
}
.badge.public { color: var(--ok); }
.badge.private { color: var(--gold); }
.badge.draft { color: var(--muted); }
.badge.published { color: var(--cyan); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.form-full { grid-column: 1 / -1; }
label { display: grid; gap: 7px; color: var(--muted); font-weight: 650; }
input, select, textarea {
    width: 100%;
    color: var(--text);
    background: rgba(5,9,14,.75);
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 12px 13px;
    font: inherit;
}
textarea { resize: vertical; min-height: 220px; }
.alert {
    border: 1px solid rgba(255,107,107,.35);
    color: #ffd6d6;
    background: rgba(255,107,107,.12);
    border-radius: 14px;
    padding: 12px 14px;
}

.login-page .app-shell { display: block; }
.login-card {
    width: min(460px, calc(100vw - 32px));
    margin: 8vh auto;
}

@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        left: 0;
        transform: translateX(-105%);
        transition: transform .2s ease;
        width: min(310px, 86vw);
    }
    .sidebar.is-open { transform: translateX(0); }
    .menu-button { display: inline-flex; }
    .topbar { padding: 18px; }
    .content-wrap { padding: 18px; }
    .grid.two, .grid.three, .form-grid { grid-template-columns: 1fr; }
}
/* Optional helpers for the Users / Roles / Groups pages. Safe to append to app.css if desired. */
.check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}
.check-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255,255,255,.04);
    color: var(--text);
}
.check-pill input { width: auto; }
.badge.admin { color: var(--gold); }
.badge.editor { color: var(--cyan); }
.badge.author { color: var(--ok); }
.badge.user { color: var(--muted); }
.badge.guest { color: var(--muted); opacity: .75; }
.badge.inactive { color: var(--danger); }
.badge.active { color: var(--ok); }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.inline-form label { min-width: min(100%, 220px); }
/* Media Library helpers. Safe to append to assets/css/app.css. */
.stack-form { display: grid; gap: 14px; }
.stack-form label { display: grid; gap: 7px; color: var(--muted); }
.stack-form input,
.stack-form select,
.stack-form textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255,255,255,.055);
    color: var(--text);
    padding: 12px 14px;
}
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}
.media-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.025));
    box-shadow: var(--shadow);
}
.media-preview {
    display: grid;
    place-items: center;
    aspect-ratio: 16 / 10;
    background: rgba(0,0,0,.25);
    border-bottom: 1px solid var(--line);
    position:relative;
}
.media-preview img,
.media-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.favorite-overlay{

    position:absolute;

    right:10px;
    bottom:10px;

    z-index:20;

}
.file-icon {
    width: 82px;
    height: 82px;
    display: grid;
    place-items: center;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(215,166,74,.3), rgba(75,215,255,.25));
    font-size: 2.4rem;
    color: var(--text);
}
.media-info { padding: 16px; }
.media-info h3 { margin: 0 0 8px; font-size: 1.05rem; }
.small { font-size: .86rem; }
.button.danger,
a.button.danger {
    color: var(--danger);
    border-color: rgba(255,107,107,.28);
    background: rgba(255,107,107,.08);
}
.alert.success {
    border-color: rgba(141,255,176,.25);
    background: rgba(141,255,176,.08);
    color: var(--ok);
}
@media (max-width: 720px) {
    .media-grid { grid-template-columns: 1fr; }
}

/* Story block composer + reader */
.block-add-card { margin-bottom: 18px; }
.block-list { display: grid; gap: 18px; }
.story-block-admin { padding: 0; overflow: hidden; }
.story-block-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    background: rgba(255,255,255,.025);
}
.block-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.block-actions form { margin: 0; }
.small-button { padding: 8px 11px; border-radius: 11px; font-size: .88rem; }
.story-block-preview { padding: 18px; }
.story-block-preview h2 { margin: 0; color: var(--text); }
.story-block-preview blockquote,
.story-quote {
    margin: 0;
    padding: 16px 18px;
    border-left: 4px solid var(--gold);
    background: rgba(215,166,74,.08);
    border-radius: 14px;
    color: var(--text);
}
.story-block-preview pre,
.story-code {
    overflow: auto;
    padding: 16px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(0,0,0,.38);
    color: #d8efff;
    white-space: pre-wrap;
}
.block-admin-thumb {
    width: min(250px, 100%);
    height: 180px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid var(--line);
}
.block-admin-video {
    width: min(420px, 100%);
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #000;
}
.block-edit-form {
    padding: 16px;
    border-top: 1px solid var(--line);
    background: rgba(0,0,0,.12);
}
.story-reader {
    display: grid;
    gap: 22px;
    max-width: 980px;
}
.story-heading {
    margin: 8px 0 0;
    font-size: clamp(1.35rem, 3vw, 2rem);
    color: var(--text);
}
.story-text {
    color: var(--text);
    line-height: 1.75;
    font-size: 1.04rem;
}
.story-divider {
    border: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(215,166,74,.65), rgba(75,215,255,.4), transparent);
    margin: 10px 0;
}
.story-media {
    margin: 0;
    display: grid;
    gap: 10px;
    justify-items: start;
}
.story-thumb-button {
    border: 0;
    padding: 0;
    background: transparent;
    cursor: zoom-in;
    text-align: left;
}
.story-media img,
.media-tile img {
    width: 250px;
    height: 180px;
    object-fit: cover;
    display: block;
    border-radius: 16px;
    border: 1px solid var(--line);
    box-shadow: 0 18px 45px rgba(0,0,0,.35);
}
.story-video-block video {
    width: min(720px, 100%);
    max-height: 70vh;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #000;
}
.story-media figcaption {
    color: var(--muted);
    line-height: 1.5;
}
.media-inline-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.story-file-block {
    display: flex;
    gap: 14px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px;
    background: rgba(255,255,255,.035);
}
.media-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 18px;
}
.media-tile {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px;
    background: rgba(255,255,255,.035);
}
.media-tile video {
    width: 250px;
    max-width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 16px;
    background: #000;
}
.media-caption { display: grid; gap: 4px; margin-top: 10px; color: var(--muted); }
.media-caption strong { color: var(--text); }

.p11-lightbox {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 1000;
    background: rgba(0,0,0,.92);
    backdrop-filter: blur(8px);
}
.p11-lightbox.is-open { display: grid; grid-template-rows: auto 1fr auto; }
.p11-lightbox-bar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255,255,255,.12);
}
.p11-lightbox-title { color: #fff; font-weight: 800; }
.p11-lightbox-actions { display: flex; gap: 8px; align-items: center; }
.p11-lightbox button,
.p11-lightbox a {
    border: 1px solid rgba(255,255,255,.18);
    background: rgba(255,255,255,.08);
    color: #fff;
    border-radius: 12px;
    padding: 9px 12px;
    text-decoration: none;
    cursor: pointer;
}
.p11-lightbox-stage {
    min-height: 0;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 18px;
}
.p11-lightbox-stage img {
    justify-self: center;
    max-width: 100%;
    max-height: calc(100vh - 170px);
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 70px rgba(0,0,0,.65);
}
.p11-lightbox-nav { font-size: 1.7rem; min-width: 48px; }
.p11-lightbox-info {
    display: none;
    padding: 12px 18px 18px;
    color: #d9e8ff;
    border-top: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.04);
}
.p11-lightbox-info.is-open { display: block; }
.p11-lightbox-info dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 8px 14px;
    margin: 0;
}
.p11-lightbox-info dt { color: var(--gold); }
.p11-lightbox-info dd { margin: 0; }

@media (max-width: 720px) {
    .story-block-head { align-items: flex-start; flex-direction: column; }
    .block-actions { width: 100%; }
    .story-media img,
    .media-tile img,
    .media-tile video { width: 100%; }
    .p11-lightbox-stage { grid-template-columns: 1fr; padding: 10px; }
    .p11-lightbox-nav { position: fixed; bottom: 18px; }
    .p11-lightbox-prev { left: 18px; }
    .p11-lightbox-next { right: 18px; }
    .p11-lightbox-bar { padding: 10px; }
}

select option {
    background: #1b2432;
    color: #eaf2ff;
}

select:focus option:checked {
    background: #f6c453;
    color: #111827;
}

.file-icon {
    width: 100%;
    height: 180px;
    border-radius: 18px 18px 0 0;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #1f2937, #0f172a);
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.file-icon span {
    width: 82px;
    height: 104px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,.65);
    font-weight: 900;
    font-size: .85rem;
    letter-spacing: .08em;
    color: #eaf2ff;
    position: relative;
}

.file-icon span::after {
    content: "";
    position: absolute;
    right: -2px;
    top: -2px;
    width: 22px;
    height: 22px;
    background: rgba(255,255,255,.18);
    clip-path: polygon(100% 0, 0 0, 100% 100%);
}

.file-archive { background: linear-gradient(135deg, #3a2a12, #111827); }
.file-pdf { background: linear-gradient(135deg, #4a1111, #111827); }
.file-doc { background: linear-gradient(135deg, #12345a, #111827); }
.file-sheet { background: linear-gradient(135deg, #123d2a, #111827); }
.file-code { background: linear-gradient(135deg, #2d1b55, #111827); }
.file-generic { background: linear-gradient(135deg, #263241, #111827); }

.file-tile {
    min-height: 180px;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at 30% 20%, rgba(75,215,255,.12), transparent 35%), linear-gradient(135deg, #111827, #1b2432);
    border-radius: 18px 18px 0 0;
    border-bottom: 1px solid rgba(255,255,255,.08);
    text-decoration: none;
}

.file-tile img {
    width: 92px;
    height: 92px;
    object-fit: contain;
    filter: drop-shadow(0 0 18px rgba(75,215,255,.18));
    transition: transform .2s ease, filter .2s ease;
}

.file-tile:hover img {
    transform: scale(1.08);
    filter: drop-shadow(0 0 22px rgba(246,196,83,.30));
}

.story-file-icon,
.post-file-icon {
    width: 100%;
    min-height: 180px;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at 30% 20%, rgba(75,215,255,.12), transparent 35%), linear-gradient(135deg, #111827, #1b2432);
    border-radius: 14px;
}

.story-file-icon img,
.post-file-icon img {
    width: 96px;
    height: 96px;
    object-fit: contain;
    filter: drop-shadow(0 0 18px rgba(75,215,255,.18));
}


/* P11 file previews in post_view.php */
.p11-file-preview {
    width: 100%;
    min-height: 178px;
    display: grid;
    place-items: center;
    gap: 8px;
    padding: 18px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(31,41,55,.95), rgba(15,23,42,.95));
    border: 1px solid rgba(255,255,255,.08);
    text-decoration: none;
}

.p11-file-preview img {
    width: 96px;
    height: 96px;
    object-fit: contain;
    filter: drop-shadow(0 12px 24px rgba(0,0,0,.35));
}

.p11-file-preview span {
    color: var(--text);
    font-weight: 900;
    letter-spacing: .12em;
    font-size: .82rem;
}

.story-file-block {
    display: grid;
    grid-template-columns: minmax(180px, 280px) 1fr;
    gap: 18px;
    align-items: center;
}

.gallery-file-preview {
    min-height: 180px;
}

@media (max-width: 720px) {
    .story-file-block {
        grid-template-columns: 1fr;
    }
}


/* Media library SVG file tiles */
.media-preview .p11-file-icon {
    width: 100%;
    height: 180px;
    display: grid;
    place-items: center;
    position: relative;
    text-decoration: none;
    border-radius: 18px 18px 0 0;
    overflow: hidden;
    background:
        radial-gradient(circle at 30% 20%, rgba(246,196,83,.16), transparent 28%),
        linear-gradient(135deg, #1b2432, #0b0f14);
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.media-preview .p11-file-icon img {
    width: 86px;
    height: 86px;
    object-fit: contain;
    filter: drop-shadow(0 0 18px rgba(75,215,255,.18));
    transition: transform .2s ease, filter .2s ease;
}

.media-preview .p11-file-icon span {
    position: absolute;
    left: 14px;
    bottom: 12px;
    padding: 5px 9px;
    border-radius: 999px;
    color: #eaf2ff;
    font-weight: 900;
    font-size: .72rem;
    letter-spacing: .1em;
    background: rgba(7,12,20,.72);
    border: 1px solid rgba(255,255,255,.12);
}

.media-preview .p11-file-icon:hover img {
    transform: scale(1.08);
    filter: drop-shadow(0 0 22px rgba(75,215,255,.34));
}

.media-preview .p11-file-icon-archive {
    background:
        radial-gradient(circle at 30% 20%, rgba(246,196,83,.22), transparent 30%),
        linear-gradient(135deg, #3a2a12, #101827);
}

.media-preview .p11-file-icon-pdf {
    background:
        radial-gradient(circle at 30% 20%, rgba(255,100,100,.20), transparent 30%),
        linear-gradient(135deg, #481313, #101827);
}

.media-preview .p11-file-icon-code {
    background:
        radial-gradient(circle at 30% 20%, rgba(176,125,255,.20), transparent 30%),
        linear-gradient(135deg, #2d1b55, #101827);
}

.media-preview .p11-file-icon-doc {
    background:
        radial-gradient(circle at 30% 20%, rgba(75,215,255,.20), transparent 30%),
        linear-gradient(135deg, #12345a, #101827);
}

.media-preview .p11-file-icon-sheet {
    background:
        radial-gradient(circle at 30% 20%, rgba(82,255,180,.18), transparent 30%),
        linear-gradient(135deg, #123d2a, #101827);
}


.media-file-preview {
    min-height: 180px;
    width: 100%;
    display: grid;
    place-items: center;
    position: relative;
    text-decoration: none;
    background:
        radial-gradient(circle at 50% 25%, rgba(246,196,83,.18), transparent 35%),
        linear-gradient(135deg, rgba(246,196,83,.14), rgba(16,24,36,.96));
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.media-file-preview .media-file-svg {
    width: 92px;
    height: 92px;
    object-fit: contain;
    filter: drop-shadow(0 12px 24px rgba(0,0,0,.35));
}

.media-file-preview .media-file-ext {
    position: absolute;
    left: 16px;
    bottom: 16px;
    padding: 5px 10px;
    border-radius: 999px;
    color: #eaf2ff;
    background: rgba(8,13,20,.82);
    border: 1px solid rgba(255,255,255,.12);
    font-size: .75rem;
    font-weight: 900;
    letter-spacing: .08em;
}

.story-collapse {
    margin: 1rem 0;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255,255,255,.035);
    overflow: hidden;
}

.story-collapse summary {
    cursor: pointer;
    padding: .9rem 1rem;
    font-weight: 800;
    color: var(--gold);
    background: rgba(255,255,255,.04);
}

.story-collapse pre {
    margin: 0;
    padding: 1rem;
    overflow-x: auto;
    background: rgba(0,0,0,.25);
}
.favorite-button {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;

    padding: 2px !important;
    margin: 0 !important;

    font-size: 28px;
    line-height: 1;

    color: rgba(255,255,255,.80);

    text-shadow: 0 1px 4px rgba(0,0,0,.85);

    cursor: pointer;
    transition: color .2s ease, transform .15s ease;
}

.favorite-button:hover {
    transform: scale(1.08);
}

.favorite-button.active {
    color: #ff4d5a;
}

.quicklink-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.quicklink-card small {
    color: var(--muted);
}

.quicklink-thumb {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--line);
}

.file-thumb{
    display:flex;
    align-items:center;
    justify-content:center;

    background:rgba(255,255,255,.05);

    border:1px solid var(--line);

    border-radius:12px;
}

.file-thumb img{
    width:84px;
    height:84px;
    object-fit:contain;
}

.media-preview {
    position: relative;
}

.media-preview > a {
    width: 100%;
    height: 100%;
    display: block;
}

.media-preview > a > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.favorite-overlay {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 30;
}

.favorite-overlay form {
    margin: 0;
}

.favorite-overlay .favorite-button {
    width: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 2px !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #fff !important;
    font-size: 38px;
    line-height: 1;
    text-shadow: 0 1px 5px #000;
}

/* Mobile entry archive — Firefox-safe card layout */
@media (max-width: 720px) {

    .table-card {
        width: 100%;
        max-width: 100%;
        padding: 0;
        overflow: visible;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .table-card table,
    .table-card tbody,
    .table-card tr {
        display: block;
        width: 100%;
        max-width: 100%;
        min-width: 0 !important;
    }

    .table-card table {
        table-layout: fixed;
    }

    .table-card thead {
        display: none;
    }

    .table-card tr {
        margin-bottom: 14px;
        padding: 16px;
        overflow: hidden;
        border: 1px solid var(--line);
        border-radius: var(--radius);
        background:
            linear-gradient(
                180deg,
                rgba(23,34,49,.92),
                rgba(18,25,35,.92)
            );
        box-shadow: var(--shadow);
    }

    .table-card td {
        display: grid;
        grid-template-columns: 96px minmax(0, 1fr);
        gap: 10px;
        align-items: center;

        width: 100%;
        max-width: 100%;
        min-width: 0;

        padding: 7px 0;
        border: 0;

        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .table-card td::before {
        color: var(--muted);
        font-size: .75rem;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: .08em;
    }

    .table-card td:nth-child(1)::before { content: "Title"; }
    .table-card td:nth-child(2)::before { content: "Category"; }
    .table-card td:nth-child(3)::before { content: "Type"; }
    .table-card td:nth-child(4)::before { content: "Status"; }
    .table-card td:nth-child(5)::before { content: "Visibility"; }
    .table-card td:nth-child(6)::before { content: "Author"; }
    .table-card td:nth-child(7)::before { content: "Created"; }
    .table-card td:nth-child(8)::before { content: "Actions"; }

    .table-card td:first-child {
        display: block;
        padding: 0 0 12px;
        margin-bottom: 6px;
        border-bottom: 1px solid var(--line);
    }

    .table-card td:first-child::before {
        display: none;
    }

    .table-card .row-title {
        display: block;
        max-width: 100%;
        font-size: 1.08rem;
        line-height: 1.35;
        overflow-wrap: anywhere;
    }

    .table-card td.actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        padding-top: 12px;
        margin-top: 5px;
        border-top: 1px solid var(--line);
    }

    .table-card td.actions::before {
        display: block;
        width: 100%;
    }

    .table-card td.actions form {
        display: inline-flex !important;
        margin: 0;
    }

    .table-card td.actions .button,
    .table-card td.actions button {
        min-height: 38px;
        padding: 8px 12px;
    }

    .table-card tr:hover td {
        background: transparent;
    }
}

.story-media-preview {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.story-media-preview .story-thumb-button {
    display: block;
}

.story-media-preview .favorite-overlay {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 30;
}

.story-media-preview .favorite-form {
    margin: 0;
}

.story-media-preview .favorite-button {
    width: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 2px !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #fff !important;
    font-size: 28px;
    line-height: 1;
    text-shadow: 0 1px 5px #000;
}

.story-video-preview {
    width: min(720px, 100%);
}

.story-video-preview video {
    display: block;
    width: 100%;
}
.favorite-overlay .favorite-button.active,
.story-media-preview .favorite-button.active {
    color: #ff4d5a !important;
}

/* Favorite buttons everywhere */

.favorite-button {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;

    padding: 2px !important;
    margin: 0 !important;

    font-size: 28px;
    line-height: 1;

    color: rgba(255,255,255,.80);

    text-shadow: 0 1px 4px rgba(0,0,0,.85);

    cursor: pointer;

    transition:
        color .18s ease,
        transform .15s ease;
}

.favorite-button:hover {
    transform: scale(1.08);
}

.favorite-button.active {
    color: #ff4d5a !important;
}

/* Covers hearts over images/videos */

.favorite-overlay .favorite-button.active,
.story-media-preview .favorite-button.active {
    color: #ff4d5a !important;
}

/* Covers hearts beside post titles and text blocks */

.story-block-favorite .favorite-button.active,
.story-post-favorite .favorite-button.active {
    color: #ff4d5a !important;
}

/* Selected favorite hearts — final override */
.title-with-favorite .favorite-button.active,
.story-block-favorite .favorite-button.active,
.story-media-favorite .favorite-button.active,
.favorite-overlay .favorite-button.active,
.story-media-preview .favorite-button.active {
    color: #ff4d5a !important;
}
/* =========================================================
   Prisme11 public encyclopedia
   ========================================================= */

.public-page {
    min-height: 100vh;
}

.public-header {
    width: min(1280px, calc(100% - 36px));
    margin: 0 auto;
    padding: 20px 0;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;

    border-bottom: 1px solid var(--line);
}

.public-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
}

.public-brand:hover {
    text-decoration: none;
}

.public-brand img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.public-brand span {
    display: grid;
    gap: 2px;
}

.public-brand strong {
    font-size: 1.05rem;
}

.public-brand small {
    color: var(--muted);
}

.public-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.public-main {
    width: min(1180px, calc(100% - 36px));
    margin: 0 auto;
    padding: 42px 0 70px;
}

.public-hero {
    min-height: 280px;
    padding: 70px 28px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    text-align: center;

    border: 1px solid var(--line);
    border-radius: 28px;

    background:
        radial-gradient(
            circle at 50% 20%,
            rgba(75,215,255,.18),
            transparent 24rem
        ),
        radial-gradient(
            circle at 75% 85%,
            rgba(215,166,74,.16),
            transparent 24rem
        ),
        linear-gradient(
            180deg,
            rgba(23,34,49,.94),
            rgba(11,15,20,.96)
        );

    box-shadow: var(--shadow);
}

.public-hero-mark img {
    width: 110px;
    height: 110px;
    object-fit: contain;
    margin-bottom: 20px;
}

.public-hero h1 {
    margin: 8px 0 16px;
    font-size: clamp(2.4rem, 8vw, 5.6rem);
    line-height: .98;
    letter-spacing: -.045em;
}

.public-hero-text {
    width: min(680px, 100%);
    margin: 0 0 28px;
    color: var(--muted);
    font-size: clamp(1rem, 2.5vw, 1.22rem);
    line-height: 1.75;
}

.public-entries {
    padding-top: 54px;
}

.public-section-heading {
    margin-bottom: 22px;

    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
}

.public-section-heading h2 {
    margin: 5px 0 0;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.public-entry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.public-entry-card {
    min-width: 0;
    overflow: hidden;

    border: 1px solid var(--line);
    border-radius: var(--radius);

    background:
        linear-gradient(
            180deg,
            rgba(23,34,49,.92),
            rgba(18,25,35,.94)
        );

    box-shadow: var(--shadow);
}

.public-entry-visual {
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: rgba(0,0,0,.28);
}

.public-entry-visual img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.public-entry-placeholder {
    width: 100%;
    height: 100%;

    display: grid;
    place-items: center;

    background:
        radial-gradient(
            circle at center,
            rgba(75,215,255,.14),
            transparent 55%
        ),
        rgba(0,0,0,.18);
}

.public-entry-placeholder img {
    width: 88px;
    height: 88px;
    object-fit: contain;
}

.public-entry-content {
    padding: 18px;

    display: flex;
    flex-direction: column;
    min-height: 260px;
}

.public-entry-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;

    color: var(--gold);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.public-entry-content h3 {
    margin: 13px 0 10px;
    font-size: 1.24rem;
    line-height: 1.28;
}

.public-entry-content h3 a {
    color: var(--text);
}

.public-entry-content h3 a:hover {
    color: var(--cyan);
    text-decoration: none;
}

.public-entry-content p {
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}

.public-entry-footer {
    margin-top: auto;
    padding-top: 18px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;

    border-top: 1px solid var(--line);
}

.public-entry-footer small {
    color: var(--muted);
}

.public-read-link {
    font-weight: 800;
}

.public-empty {
    text-align: center;
}

.public-post-main {
    width: min(980px, calc(100% - 36px));
}

.public-post-header {
    padding: 34px 0 28px;
    border-bottom: 1px solid var(--line);
}

.public-post-header h1 {
    margin: 8px 0 18px;
    font-size: clamp(2rem, 6vw, 4.4rem);
    line-height: 1.04;
    letter-spacing: -.035em;
}

.public-post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    color: var(--muted);
}

.public-story-reader {
    margin-top: 28px;
    display: grid;
    gap: 24px;
}

.public-story-media {
    margin: 0;
    display: grid;
    gap: 10px;
}

.public-story-media img {
    width: min(100%, 900px);
    max-height: 80vh;
    object-fit: contain;

    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(0,0,0,.25);
}

.public-story-media video {
    width: 100%;
    max-height: 80vh;

    border: 1px solid var(--line);
    border-radius: 18px;
    background: #000;
}

.public-story-media figcaption {
    color: var(--muted);
}

.public-file-card {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 20px;
    align-items: center;

    padding: 18px;

    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255,255,255,.035);
}

.public-file-card > img {
    width: 96px;
    height: 96px;
    object-fit: contain;
}

.public-file-card p {
    color: var(--muted);
}

.public-back {
    margin-top: 24px;
}

.public-footer {
    width: min(1180px, calc(100% - 36px));
    margin: 0 auto;
    padding: 28px 0 42px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;

    color: var(--muted);
    border-top: 1px solid var(--line);
}

.public-footer img {
    width: 38px;
    height: 38px;
    object-fit: contain;
}

.public-footer div {
    display: grid;
    gap: 2px;
}

.public-footer strong {
    color: var(--text);
}

@media (max-width: 720px) {
    .public-header {
        width: min(100% - 24px, 1280px);
        padding: 14px 0;
    }

    .public-brand small {
        display: none;
    }

    .public-brand img {
        width: 42px;
        height: 42px;
    }

    .public-main,
    .public-post-main {
        width: min(100% - 24px, 1180px);
        padding-top: 24px;
    }

    .public-hero {
        min-height: 390px;
        padding: 48px 20px;
        border-radius: 22px;
    }

    .public-hero-mark img {
        width: 86px;
        height: 86px;
    }

    .public-section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .public-entry-grid {
        grid-template-columns: 1fr;
    }

    .public-file-card {
        grid-template-columns: 1fr;
    }

    .public-post-header {
        padding-top: 18px;
    }

    .public-footer {
        width: min(100% - 24px, 1180px);
    }
}
.public-attached-media {
    margin-top: 32px;
}

.public-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
}

.public-media-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255,255,255,.035);
}

.public-media-image,
.public-media-video {
    width: 100%;
    height: 190px;
    display: block;
    object-fit: cover;
    background: #000;
}

.public-media-file {
    min-height: 190px;
    display: grid;
    place-items: center;
    background:
        radial-gradient(
            circle at center,
            rgba(75,215,255,.14),
            transparent 55%
        ),
        rgba(0,0,0,.18);
}

.public-media-file img {
    width: 92px;
    height: 92px;
    object-fit: contain;
}

.public-media-info {
    display: grid;
    gap: 10px;
    padding: 16px;
}

.public-media-info p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

@media (max-width: 720px) {
    .public-media-grid {
        grid-template-columns: 1fr;
    }

    .public-media-image,
    .public-media-video {
        height: auto;
        max-height: 70vh;
        object-fit: contain;
    }
}

.login-nav{
    width:min(440px, calc(100% - 2rem));
    margin:2rem auto 1rem;

    display:flex;
    justify-content:flex-start;
}

.login-nav .button{
    min-width:110px;
}

.brand{
    text-decoration:none;
    color:inherit;
}
