: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;
    }
}
/* ===== Users page: author photo + bio fields (aliased kxu-* to avoid collisions) ===== */
.kxu-error{background:#fdecec;border:1px solid #e8b4b4;color:#8a1c1c;padding:12px 14px;border-radius:8px;margin-bottom:16px;font-weight:600}
.kxu-form .kxu-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px}
.kxu-field{display:flex;flex-direction:column;gap:6px;margin-bottom:12px}
.kxu-field>span{font-size:12.5px;font-weight:700;color:#6b6455}
.kxu-field input:not([type=file]),.kxu-field textarea{width:100%;padding:9px 11px;border:1px solid #d8d2c2;border-radius:8px;font-size:14px;font-family:inherit;background:#fff;color:#3a362c}
.kxu-field input:not([type=file]):focus,.kxu-field textarea:focus{outline:none;border-color:#a32020;box-shadow:0 0 0 3px rgba(163,32,32,.12)}
.kxu-field textarea{resize:vertical;min-height:74px;line-height:1.5}
.kxu-check{display:flex;align-items:center;gap:8px;font-size:13px;color:#6b6455;margin-bottom:12px}
.kxu-user{border:1px solid #ece7d9;border-radius:12px;padding:14px;background:#fff;margin-bottom:12px}
.kxu-user-head{display:flex;align-items:flex-start;gap:14px;flex-wrap:wrap}
.kxu-avatar{width:56px;height:56px;border-radius:50%;flex-shrink:0;overflow:hidden;background:linear-gradient(135deg,#a91d1d,#6a1313);color:#fff;display:flex;align-items:center;justify-content:center;font-size:22px;font-weight:900}
.kxu-avatar img{width:100%;height:100%;object-fit:cover;display:block}
.kxu-user-info{flex:1;min-width:200px;display:flex;flex-direction:column;gap:3px}
.kxu-user-info strong{font-size:16px}
.kxu-sub{font-size:12.5px;color:#8a8374}
.kxu-bio{font-size:13px;color:#6b6455;margin:6px 0 0;line-height:1.5}
.kxu-warn{font-size:12px;color:#b06a00;font-weight:600}
.kxu-user-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.kxu-user-actions form{margin:0}
.kxu-edit{margin-top:12px;border-top:1px dashed #e2dccd;padding-top:10px}
.kxu-edit>summary{cursor:pointer;font-size:13px;font-weight:700;color:#a32020;margin-bottom:10px}
/* ===== Reports page: summary + story rows (kxu-*) ===== */
.kxu-summary{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px;margin-bottom:8px}
.kxu-stat{background:#fff;border:1px solid #ece7d9;border-radius:12px;padding:14px;display:flex;flex-direction:column;gap:4px}
.kxu-stat b{font-size:20px;color:#a10e17;line-height:1.2}
.kxu-stat span{font-size:12px;color:#8a8374;font-weight:700}
.kxu-chips{display:flex;flex-wrap:wrap;gap:8px;margin-top:6px}
.kxu-chip{background:#f3ede2;border:1px solid #e2dccd;border-radius:20px;padding:4px 12px;font-size:12.5px;color:#6b6455}
.kxu-rep-row{display:flex;align-items:center;gap:14px;background:#fff;border:1px solid #ece7d9;border-radius:10px;padding:10px 12px;margin-bottom:8px}
.kxu-rep-date{font-size:12px;color:#8a8374;white-space:nowrap;min-width:150px;font-weight:700}
.kxu-rep-main{flex:1;min-width:200px}
.kxu-rep-main a{color:#1f3a63;font-weight:700;text-decoration:none;line-height:1.4}
.kxu-rep-main a:hover{color:#a10e17}
.kxu-rep-sub{display:block;font-size:12px;color:#8a8374;margin-top:2px}
@media (max-width:640px){.kxu-rep-row{flex-wrap:wrap}.kxu-rep-date{min-width:0}}
/* ===== Users table layout (replaces the old card-style list) =====
   Uses the existing .admin-table / .admin-row grid convention so the list
   matches dashboard.php / drafts.php / post.php. */
.users-table { display: grid; gap: 0; }
.user-row {
    display: grid;
    grid-template-columns: 56px minmax(150px, 1.6fr) minmax(120px, 1.3fr) minmax(110px, 1.2fr) minmax(90px, 0.7fr) minmax(110px, 0.8fr) auto;
    gap: 14px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}
.user-row:last-of-type { border-bottom: 0; }
.user-avatar {
    width: 56px; height: 56px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
    background: linear-gradient(135deg,#a91d1d,#6a1313); color:#fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 900;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.user-name a { color: var(--accent); font-weight: 900; text-decoration: none; }
.user-name a:hover { color: #a10e17; }
.user-display { color: var(--muted); font-size: 13px; }
.user-role-role { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.role-badge { font-size: 11px; font-weight: 900; letter-spacing: .4px; text-transform: uppercase; }
.role-admin { color: #a10e17; }
.role-editor { color: #1f3a63; }
.status-dot { font-size: 12px; color: var(--muted); }
.user-count b { color: var(--accent); }
.user-count { font-size: 13px; color: var(--muted); }
.user-joined { font-size: 12px; color: #8a8374; }
.user-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-actions form { margin: 0; }
.user-actions button { padding: 7px 11px; background: #eef1f7; color: #a10e17; }

.user-meta-row { display: grid; grid-template-columns: 56px 1fr; gap: 14px; padding: 6px 0 12px; align-items: flex-start; }
.user-meta { display: flex; flex-direction: column; gap: 4px; }
.user-bureau { font-size: 12px; font-weight: 700; color: #8a2f1d; letter-spacing: .3px; }
.user-bio { font-size: 13px; color: #6b6455; margin: 0; line-height: 1.5; }
.user-warn { font-size: 12px; color: #b06a00; font-weight: 600; }
.user-edit-row { padding: 10px 0; border-top: 1px dashed #e2dccd; }
.kxu-edit { margin-top: 0; border-top: 0; padding-top: 0; }
.kxu-edit > summary { cursor: pointer; font-size: 13px; font-weight: 700; color: #a10e17; margin-bottom: 10px; }

@media (max-width: 980px) {
    .user-row { grid-template-columns: 56px 1fr auto; }
    .user-display, .user-role-role, .user-count, .user-joined { display: none; }
    .user-actions { grid-column: 2 / -1; justify-self: start; }
}
@media (max-width: 640px) {
    .user-row { grid-template-columns: 48px 1fr; gap: 10px; padding: 10px 0; }
    .user-actions { grid-column: 2 / -1; }
    .user-meta-row { grid-template-columns: 48px 1fr; }
}
/* ===== role dropdown (Users page) ===== */
.kxu-field select{width:100%;padding:9px 11px;border:1px solid #d8d2c2;border-radius:8px;font-size:14px;font-family:inherit;background:#fff;color:#3a362c}
.kxu-field select:focus{outline:none;border-color:#a32020;box-shadow:0 0 0 3px rgba(163,32,32,.12)}
