/* Quản trị blog — giao diện công cụ, không phải trang tiếp thị.
   Cố ý tách khỏi CSS của landing: trang này cần mật độ cao và thao tác nhanh,
   dùng chung hệ gián cách của trang bán hàng sẽ rất loãng. */

:root {
    --ink: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --bg: #f6f7f9;
    --card: #ffffff;
    --brand: #4f46e5;
    --danger: #b91c1c;
    --ok: #047857;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
}

.loading { padding: 60px; text-align: center; color: var(--muted); }
.err { color: var(--danger); margin: 10px 0; }

/* ---------- Đăng nhập ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
    width: 100%; max-width: 380px; background: var(--card);
    border: 1px solid var(--line); border-radius: 16px;
    padding: 32px 30px; box-shadow: 0 8px 28px rgba(0,0,0,.06);
}
.login-card h1 { font-size: 1.22rem; margin: 6px 0 20px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.brand span { font-size: 1.2rem; }

/* ---------- Thanh trên ---------- */
.top {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 14px 22px; background: var(--card); border-bottom: 1px solid var(--line);
}
.top .brand { gap: 10px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 26px 22px 70px; }

/* ---------- Biểu mẫu ---------- */
label { display: block; margin-bottom: 16px; font-weight: 600; font-size: .88rem; }
label small { display: block; font-weight: 400; color: var(--muted); margin-top: 2px; }
input, textarea, select {
    width: 100%; margin-top: 6px; padding: 10px 12px;
    border: 1px solid var(--line); border-radius: 9px;
    font: inherit; background: #fff; color: var(--ink);
}
input:focus, textarea:focus, select:focus {
    outline: none; border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(79,70,229,.13);
}
input[readonly] { background: var(--bg); color: var(--muted); }
textarea { resize: vertical; }
textarea.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .9rem; line-height: 1.65;
}
#slug-warn { color: var(--danger); }

/* ---------- Nút ---------- */
button, .btn-link {
    padding: 8px 15px; border: 1px solid var(--line); border-radius: 9px;
    background: #fff; color: var(--ink); font: inherit; font-weight: 600;
    cursor: pointer; text-decoration: none; display: inline-block;
}
button:hover, .btn-link:hover { border-color: #c7cad1; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover { filter: brightness(1.07); }
button.danger { color: var(--danger); border-color: #f3c9c9; }
button:disabled { opacity: .6; cursor: default; }
.login-card button { width: 100%; padding: 11px; margin-top: 6px; }
.top .brand button { padding: 4px 11px; margin-right: 4px; }

/* ---------- Danh sách ---------- */
.list {
    width: 100%; border-collapse: collapse;
    background: var(--card); border: 1px solid var(--line); border-radius: 14px;
    overflow: hidden;
}
.list th, .list td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--line); }
.list th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.list tr:last-child td { border-bottom: none; }
.list .slug { color: var(--muted); font-size: .8rem; margin-top: 2px; }
.list .right { text-align: right; white-space: nowrap; }
.list .nowrap { white-space: nowrap; }
.list .empty { text-align: center; color: var(--muted); padding: 50px; }

.badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: .76rem; font-weight: 700;
}
.badge.draft     { background: #f3f4f6; color: #4b5563; }
.badge.published { background: #d1fae5; color: var(--ok); }
.badge.archived  { background: #fee2e2; color: #991b1b; }

/* ---------- Soạn bài ---------- */
.editor { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 28px; align-items: start; }
.col-main, .col-side {
    background: var(--card); border: 1px solid var(--line);
    border-radius: 14px; padding: 22px;
}
.col-side { position: sticky; top: 76px; }
.col-side hr { border: none; border-top: 1px solid var(--line); margin: 20px 0; }

/* ---------- Thông báo ---------- */
.toast {
    position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
    background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 10px;
    font-size: .9rem; box-shadow: 0 8px 24px rgba(0,0,0,.2); z-index: 100;
}
.toast.err { background: var(--danger); }

@media (max-width: 900px) {
    .editor { grid-template-columns: 1fr; }
    .col-side { position: static; }
    .wrap { padding: 18px 14px 60px; }
    .list th:nth-child(3), .list td:nth-child(3) { display: none; }
}
