:root {
    --bg: #f5faf6;
    --surface: #ffffff;
    --surface-soft: #f0f7f2;
    --line: #d8e9dc;
    --text: #1e2c20;
    --muted: #5d7462;
    --green: #1f8a47;
    --green-dark: #146734;
    --danger: #b63a3a;
    --radius: 12px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Manrope', sans-serif;
    background: radial-gradient(circle at top right, #e8f7eb 0%, var(--bg) 55%);
    color: var(--text);
}

a {
    color: var(--green-dark);
    text-decoration: none;
}

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

.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--line);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.brand {
    font-weight: 800;
    font-size: 22px;
    color: var(--green-dark);
}

.mobile-menu-toggle,
.mobile-close {
    display: none;
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-link {
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    color: var(--muted);
}

.menu-link:hover,
.menu-link.active {
    background: #e7f5eb;
    color: var(--green-dark);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.user-name {
    font-weight: 700;
}

.user-email {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 14px;
}

.main {
    padding: 22px;
}

.page-header {
    margin-bottom: 18px;
}

.page-header h1 {
    margin: 0;
    font-size: 28px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 16px;
}

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

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

.kpi {
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, #ffffff, #f3fbf5);
}

.kpi-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--green-dark);
}

.kpi-label {
    color: var(--muted);
    font-weight: 600;
}

label {
    display: block;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 6px;
}

label.label-with-maxlen {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.maxlen-indicator {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    line-height: 1;
    white-space: nowrap;
}

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

textarea {
    min-height: 110px;
    resize: vertical;
}

.field {
    margin-bottom: 14px;
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn {
    border: 0;
    border-radius: 10px;
    background: var(--green);
    color: #fff;
    padding: 10px 14px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:hover {
    background: var(--green-dark);
}

.btn-outline {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
}

.btn-danger {
    background: var(--danger);
}

.alert {
    border-radius: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    margin-bottom: 14px;
    font-weight: 600;
}

.alert-success {
    background: #ebf8ef;
    border-color: #b9e2c4;
}

.alert-error {
    background: #ffecec;
    border-color: #f3c1c1;
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

th,
td {
    padding: 11px;
    border-bottom: 1px solid #edf5ef;
    text-align: left;
    vertical-align: top;
}

th {
    font-size: 13px;
    color: var(--muted);
    font-weight: 800;
}

.badge {
    display: inline-block;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
}

.badge-draft {
    background: #f1f3f5;
    color: #4a5560;
}

.badge-published {
    background: #e7f8ec;
    color: #176b34;
}

.badge-archived {
    background: #fff5e9;
    color: #8f6424;
}

.badge-active {
    background: #e7f8ec;
    color: #176b34;
}

.badge-inactive {
    background: #f1f3f5;
    color: #4a5560;
}

.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 22px;
}

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

.muted {
    color: var(--muted);
    font-size: 13px;
}

.inline-form {
    display: inline;
}

.multi-select {
    min-height: 130px;
}

.pagination {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

@media (max-width: 980px) {
    body.admin-app.menu-open {
        overflow: hidden;
    }

    .layout {
        display: block;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(320px, 84vw);
        border-right: 1px solid var(--line);
        transform: translateX(-105%);
        transition: transform 0.22s ease;
        z-index: 1001;
        overflow-y: auto;
    }

    body.admin-app.menu-open .sidebar {
        transform: translateX(0);
    }

    .mobile-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 1px solid var(--line);
        border-radius: 10px;
        background: #fff;
        color: var(--text);
        padding: 8px 12px;
        font-weight: 700;
        line-height: 1.2;
        cursor: pointer;
    }

    .mobile-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: #fff;
        color: var(--text);
        padding: 6px 10px;
        font-weight: 700;
        line-height: 1.1;
        cursor: pointer;
    }

    .main {
        padding: 14px;
    }

    .page-header {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 12px;
    }

    .page-header h1 {
        font-size: 24px;
    }

    .card {
        padding: 14px;
    }

    input,
    select,
    textarea {
        font-size: 16px;
    }

    .btn {
        min-height: 42px;
    }

    .table-wrap table {
        min-width: 760px;
    }

    .grid-two,
    .grid-three,
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .page-header h1 {
        font-size: 22px;
    }

    .actions {
        flex-direction: column;
        align-items: stretch;
    }

    .actions .btn,
    .actions a.btn,
    .actions form.inline-form,
    .actions form.inline-form .btn {
        width: 100%;
    }

    th,
    td {
        padding: 9px;
    }

    .kpi-value {
        font-size: 24px;
    }

    .login-wrap {
        padding: 12px;
    }

    .login-card {
        padding: 16px;
    }
}
