:root {
    --ink: #151927;
    --muted: #6a7284;
    --line: #e5e8ef;
    --accent: #d7242f;
    --panel: #ffffff;
    --bg: #f4f6fa;
    --nav: #11152a;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--bg);
    font-family: Arial, Helvetica, sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

.admin-login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #10142f 0%, #20263d 55%, #d7242f 160%);
}

.login-card {
    width: min(430px, 100%);
    background: #fff;
    border: 1px solid rgba(255,255,255,.22);
    box-shadow: 0 24px 70px rgba(0,0,0,.24);
    padding: 28px;
}

.login-card img {
    width: 260px;
    max-width: 100%;
}

.login-card h1,
.admin-top h1 {
    margin: 12px 0 6px;
}

.login-card p,
.admin-top span {
    color: var(--muted);
}

.login-card form,
.admin-form {
    display: grid;
    gap: 12px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    padding: 12px;
    font: inherit;
}

label {
    display: grid;
    gap: 7px;
    color: #333;
    font-weight: 700;
}

button,
.admin-btn {
    border: 0;
    background: var(--accent);
    color: #fff;
    padding: 12px 16px;
    font-weight: 900;
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.admin-btn.ghost {
    background: #eef1f7;
    color: var(--ink);
}

.admin-alert,
.admin-success {
    padding: 12px;
    margin: 12px 0;
    font-weight: 800;
}

.admin-alert {
    color: #a10e17;
    background: #ffecef;
}

.admin-success {
    color: #12622f;
    background: #e9f8ef;
}

.admin-side {
    position: fixed;
    inset: 0 auto 0 0;
    width: 248px;
    background: var(--nav);
    color: #fff;
    padding: 22px 16px;
    display: grid;
    align-content: start;
    gap: 9px;
}

.admin-side img {
    width: 190px;
    background: #fff;
    padding: 8px;
    margin-bottom: 16px;
}

.admin-side a {
    padding: 12px 13px;
    color: #dfe4f3;
    font-weight: 800;
}

.admin-side a.active,
.admin-side a:hover {
    background: rgba(255,255,255,.1);
    color: #fff;
}

.admin-main {
    margin-left: 248px;
    padding: 28px;
}

.admin-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 22px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.stat-grid div,
.admin-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: 0 8px 24px rgba(20,28,45,.04);
}

.stat-grid div {
    padding: 18px;
}

.stat-grid span {
    display: block;
    color: var(--muted);
    font-weight: 800;
    text-transform: uppercase;
    font-size: 12px;
}

.stat-grid strong {
    display: block;
    margin-top: 8px;
    font-size: 34px;
}

.admin-panel {
    padding: 18px;
    margin-bottom: 18px;
}

.panel-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 13px;
    margin-bottom: 12px;
}

.panel-title h2 {
    margin: 0;
}

.panel-title a {
    color: var(--accent);
    font-weight: 900;
}

.admin-table {
    display: grid;
}

.admin-row {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 130px 100px 120px auto;
    gap: 14px;
    align-items: center;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
}

.admin-row span {
    color: var(--muted);
}

.admin-row strong a {
    color: inherit;
    text-decoration: none;
}

.admin-row form {
    margin: 0;
}

.admin-row button {
    padding: 8px 10px;
    background: #eef1f7;
    color: #a10e17;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.story-form {
    gap: 16px;
}

.seo-box {
    display: grid;
    gap: 14px;
    background: #f8fafc;
    border: 1px solid var(--line);
    padding: 16px;
}

.seo-box .panel-title {
    margin-bottom: 0;
}

.seo-box .panel-title span {
    color: var(--muted);
    font-weight: 700;
}

.check-label {
    display: flex;
    align-items: center;
    gap: 10px;
    align-self: end;
    padding: 12px;
    border: 1px solid var(--line);
    background: #fff;
}

.check-label input {
    width: auto;
}

.form-actions {
    display: flex;
    gap: 10px;
}

.compact {
    grid-template-columns: 1fr 1fr 160px auto;
    align-items: end;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.media-card {
    background: #fff;
    border: 1px solid var(--line);
    padding: 10px;
    display: grid;
    gap: 9px;
}

.media-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: #eef1f7;
}

.media-card input {
    font-size: 12px;
}

.media-card button {
    width: 100%;
    background: #eef1f7;
    color: #a10e17;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.posts-form {
    margin-top: 4px;
}

.posts-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.posts-toolbar select {
    width: auto;
    padding: 8px 10px;
}

.posts-toolbar .admin-btn {
    padding: 8px 14px;
}

.posts-count {
    margin-left: auto;
    color: var(--muted);
    font-weight: 700;
    font-size: 13px;
}

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

.posts-table {
    width: 100%;
    border-collapse: collapse;
}

.posts-table th,
.posts-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.posts-table thead th {
    background: #f8fafc;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    font-weight: 800;
}

.posts-table tbody tr:hover {
    background: #fafbfd;
}

.posts-table .col-check {
    width: 34px;
}

.posts-table .col-check input {
    width: auto;
    padding: 0;
}

.posts-table .col-thumb {
    width: 84px;
}

.thumb-link {
    display: inline-block;
    width: 70px;
    height: 70px;
}

.thumb {
    display: block;
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: #f2f4f8;
}

.thumb-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #c3c9d6;
    font-size: 22px;
    background: #f6f8fb;
}

.thumb-link:hover .thumb {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(215, 36, 47, .15);
}

.posts-table .post-title {
    font-weight: 800;
    color: var(--ink);
}

.posts-table .post-title:hover {
    color: var(--accent);
}

.posts-table .cat-name {
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.posts-table .col-date {
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    text-transform: capitalize;
    letter-spacing: .02em;
}

.badge-publish {
    background: #e9f8ef;
    color: #12622f;
}

.badge-draft {
    background: #fff4e0;
    color: #8a6100;
}

.badge-pending {
    background: #ffecef;
    color: #a10e17;
}

.act-btn {
    display: inline-block;
    padding: 6px 11px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 5px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.act-btn:hover {
    background: #f2f4f8;
}

.act-del {
    color: #a10e17;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
}

.page-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    font-weight: 800;
    font-size: 13px;
}

.page-link:hover {
    background: #f2f4f8;
}

.page-info {
    color: var(--muted);
    font-weight: 700;
    font-size: 13px;
}

.thumb-preview {
    position: fixed;
    z-index: 9999;
    display: none;
    pointer-events: none;
}

.thumb-preview.show {
    display: block;
}

.thumb-preview img {
    width: 250px;
    max-width: 250px;
    max-height: 250px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line);
    box-shadow: 0 12px 32px rgba(20, 28, 45, .22);
    background: #fff;
}

@media (max-width: 860px) {
    .posts-table .col-author {
        display: none;
    }
}

@media (max-width: 600px) {
    .posts-table .col-status,
    .posts-table .col-date {
        display: none;
    }

    .posts-table .col-thumb {
        width: 58px;
    }

    .thumb-link {
        width: 50px;
        height: 50px;
    }

    .thumb {
        width: 50px;
        height: 50px;
        font-size: 16px;
    }

    .thumb-placeholder {
        font-size: 16px;
    }

    .thumb-preview img {
        width: 180px;
        max-height: 180px;
    }

    .posts-count {
        display: none;
    }
}

@media (max-width: 860px) {
    .admin-side {
        position: static;
        width: auto;
    }

    .admin-main {
        margin-left: 0;
        padding: 16px;
    }

    .admin-top,
    .form-actions {
        display: grid;
    }

    .stat-grid,
    .form-grid,
    .compact,
    .media-grid {
        grid-template-columns: 1fr;
    }

    .admin-row {
        grid-template-columns: 1fr;
    }
}
