:root {
    --bg: #f1f4f2;
    --surface: #ffffff;
    --ink: #15211b;
    --ink-soft: #5a6b62;
    --green: #0f3d2e;
    --green-600: #16553f;
    --gold: #b8860b;
    --line: #e2e7e3;
    --danger: #c0392b;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(15,61,46,0.08), 0 6px 20px -8px rgba(15,61,46,0.15);
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Outfit", system-ui, sans-serif;
    background: var(--bg);
    color: var(--ink);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 0.97rem;
}
a { color: var(--green-600); }
.muted { color: var(--ink-soft); }

/* topbar */
.adm-topbar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.7rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 10;
    flex-wrap: wrap;
}
.adm-brand { display: flex; align-items: center; gap: 0.55rem; font-size: 1.05rem; text-decoration: none; color: var(--green); }
.adm-brand strong { font-weight: 700; }
.adm-nav { display: flex; gap: 0.35rem; flex: 1; flex-wrap: wrap; }
.adm-nav a {
    position: relative;
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--ink-soft);
    font-weight: 500;
}
.adm-nav a:hover { background: var(--bg); color: var(--green); }
.adm-nav a.is-active { background: var(--green); color: #fff; }
.adm-badge {
    display: inline-block;
    min-width: 1.2rem;
    padding: 0 0.35rem;
    margin-left: 0.3rem;
    font-size: 0.72rem;
    line-height: 1.2rem;
    text-align: center;
    background: var(--gold);
    color: #1c1403;
    border-radius: 999px;
    font-weight: 700;
}
.adm-user { display: flex; align-items: center; gap: 0.85rem; font-size: 0.9rem; }
.adm-user a { text-decoration: none; }
.adm-sep { width: 1px; height: 1.1rem; background: var(--line); }
.adm-logout { color: var(--danger) !important; font-weight: 600; }

/* layout */
.adm-main { flex: 1; width: 100%; max-width: 70rem; margin: 0 auto; padding: 2rem 1.5rem; }
.adm-footer { text-align: center; padding: 1.5rem; color: var(--ink-soft); font-size: 0.85rem; }

.adm-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.adm-head h1 { font-size: 1.6rem; margin: 0; }
.adm-head p { margin: 0.25rem 0 0; color: var(--ink-soft); }

/* stat cards */
.adm-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 2rem; }
.adm-stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow); }
.adm-stat strong { display: block; font-size: 1.9rem; line-height: 1; color: var(--green); }
.adm-stat span { color: var(--ink-soft); font-size: 0.85rem; }
@media (max-width: 720px) { .adm-stats { grid-template-columns: repeat(2, 1fr); } }

/* card / panel */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel-head { padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); font-weight: 600; }

/* table */
table.adm-table { width: 100%; border-collapse: collapse; }
.adm-table th, .adm-table td { text-align: left; padding: 0.8rem 1.25rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.adm-table th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); }
.adm-table tr:last-child td { border-bottom: none; }
.adm-table .t-title { font-weight: 600; }
.adm-table .t-title a { text-decoration: none; }
.adm-table .row-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }

.pill { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.pill-pub { background: #d8f3e3; color: #146a45; }
.pill-draft { background: #fbe5c8; color: #875c08; }
.pill-cat { background: #eef1ef; color: var(--ink-soft); }

/* buttons */
.btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.6rem 1.1rem; border-radius: 9px; border: 1px solid transparent;
    font: inherit; font-weight: 600; font-size: 0.9rem; cursor: pointer; text-decoration: none;
    background: var(--green); color: #fff; transition: background 0.15s, transform 0.1s;
}
.btn:hover { background: var(--green-600); }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.82rem; }
.btn-light { background: var(--bg); color: var(--ink); border-color: var(--line); }
.btn-light:hover { background: #e7ece9; color: var(--ink); }
.btn-danger { background: #fbeaea; color: var(--danger); border-color: #f0cfca; }
.btn-danger:hover { background: #f6dad7; color: var(--danger); }
.btn-gold { background: var(--gold); color: #1c1403; }
.btn-gold:hover { background: #cf9c1f; }

/* forms */
.adm-form { display: grid; gap: 1.25rem; }
.adm-grid { display: grid; grid-template-columns: 1fr 320px; gap: 1.5rem; align-items: start; }
@media (max-width: 880px) { .adm-grid { grid-template-columns: 1fr; } }
.field label { display: block; font-weight: 600; font-size: 0.88rem; margin-bottom: 0.4rem; }
.field .hint { font-weight: 400; color: var(--ink-soft); font-size: 0.8rem; }
input, select, textarea {
    width: 100%; font: inherit; padding: 0.65rem 0.8rem;
    border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(22,85,63,0.12); }
textarea { resize: vertical; min-height: 120px; }
textarea.code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.9rem; min-height: 340px; line-height: 1.6; }
.checkbox { display: flex; align-items: center; gap: 0.55rem; }
.checkbox input { width: auto; }

.side-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; display: grid; gap: 1.1rem; }
.side-card h2 { font-size: 1rem; margin: 0; }

.alert { padding: 0.8rem 1.1rem; border-radius: 10px; margin-bottom: 1.25rem; }
.alert-error { background: #fbeaea; color: var(--danger); border: 1px solid #f0cfca; }
.alert-success { background: #d8f3e3; color: #146a45; border: 1px solid #aedcc4; }

.form-actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }

/* image upload */
.img-preview { margin-top: 0.6rem; border-radius: 9px; overflow: hidden; border: 1px solid var(--line); display: none; }
.img-preview.show { display: block; }
.img-preview img { width: 100%; display: block; }
.upload-status { font-size: 0.82rem; color: var(--ink-soft); margin-top: 0.4rem; min-height: 1.1em; }

/* login */
.login-wrap { flex: 1; display: grid; place-items: center; padding: 2rem; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 2rem; }
.login-card h1 { font-size: 1.4rem; margin: 0 0 0.4rem; }
.login-card .logo { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1.25rem; color: var(--green); font-weight: 700; }
.login-card .logo img { width: 48px; height: auto; }

/* messages */
.msg-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem 1.5rem; margin-bottom: 1rem; }
.msg-card.unread { border-left: 4px solid var(--gold); }
.msg-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: baseline; }
.msg-head strong { font-size: 1.05rem; }
.msg-meta { color: var(--ink-soft); font-size: 0.85rem; }
.msg-body { margin: 0.75rem 0 0; white-space: pre-wrap; }

.empty { text-align: center; padding: 3rem 1rem; color: var(--ink-soft); }
