:root {
    --bg: #f5f7f5;
    --panel: #ffffff;
    --ink: #17212b;
    --muted: #6b7280;
    --line: #dfe3e0;
    --teal: #126c63;
    --red: #b13b3b;
    --blue: #315bb6;
    --amber: #b96f14;
    --violet: #6b4aa0;
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

input,
textarea,
select,
button {
    font: inherit;
}

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

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

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

th,
td {
    text-align: left;
    padding: 14px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--muted);
}

td small {
    display: block;
    color: var(--muted);
    margin-top: 4px;
}

.admin-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    background: #15221f;
    color: #fff;
    padding: 22px;
    display: flex;
    flex-direction: column;
}

.brand {
    display: grid;
    gap: 2px;
    margin-bottom: 28px;
}

.brand span {
    color: #9dd8ce;
    font-size: 13px;
    text-transform: uppercase;
    font-weight: 800;
}

.brand strong {
    font-size: 25px;
}

.sidebar nav {
    display: grid;
    gap: 6px;
}

.sidebar nav a,
.sidebar-footer a {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 11px 12px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.78);
}

.sidebar nav a.active,
.sidebar nav a:hover,
.sidebar-footer a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.sidebar svg {
    width: 18px;
    height: 18px;
}

.sidebar-footer {
    margin-top: auto;
    display: grid;
    gap: 4px;
}

.workspace {
    padding: 26px;
    min-width: 0;
}

.workspace-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    margin-bottom: 22px;
}

.workspace-header h1 {
    margin: 4px 0 0;
    font-size: clamp(28px, 4vw, 44px);
    letter-spacing: 0;
}

.eyebrow {
    color: var(--red);
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 800;
}

.user-chip {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 12px;
    min-width: 180px;
}

.user-chip span,
.user-chip small {
    display: block;
}

.user-chip small {
    color: var(--muted);
}

.flash {
    padding: 12px 14px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    border: 1px solid var(--line);
    background: #fff;
}

.flash.success {
    border-color: #a9d8c5;
    background: #eefaf5;
}

.flash.warning {
    border-color: #efd098;
    background: #fff7e8;
}

.flash.error {
    border-color: #e2aaa9;
    background: #fff1f1;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 6px;
    padding: 10px 12px;
    cursor: pointer;
    font-weight: 750;
}

.button.primary {
    background: var(--teal);
    border-color: var(--teal);
    color: #fff;
}

.button.danger {
    color: #fff;
    background: var(--red);
    border-color: var(--red);
}

.button.small {
    padding: 7px 9px;
    font-size: 13px;
}

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

.compact-metrics strong {
    font-size: 30px;
}

.metrics div,
.panel,
.table-card,
.workflow-card,
.media-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.metrics div {
    padding: 20px;
}

.metrics strong {
    display: block;
    font-size: 38px;
    line-height: 1;
}

.metrics span {
    color: var(--muted);
    font-weight: 700;
}

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

.panel {
    padding: 18px;
}

.panel h2 {
    margin: 0 0 14px;
    font-size: 18px;
}

.status-row,
.list-item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.list-item {
    flex-direction: column;
}

.list-item span {
    font-weight: 800;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.filters,
.inline-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.workflow-actions-panel {
    margin-top: 18px;
}

.delete-article-form {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.users-tools,
.users-grid {
    margin-bottom: 18px;
}

.role-permissions {
    display: grid;
    gap: 10px;
}

.role-permissions article {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 11px;
    background: #fbfcfb;
}

.role-permissions strong,
.role-permissions span {
    display: block;
}

.role-permissions span {
    color: var(--muted);
    margin-top: 3px;
    font-size: 13px;
}

.category-inline-form {
    align-items: stretch;
}

.category-inline-form input[type="color"] {
    width: 54px;
    min-width: 54px;
    padding: 4px;
}

.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 14px;
}

.user-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
}

.user-card.disabled {
    opacity: 0.72;
}

.user-card-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.user-card-head strong,
.user-card-head span,
.user-meta span {
    display: block;
}

.user-card-head span,
.user-meta {
    color: var(--muted);
    font-size: 13px;
}

.switch-row {
    display: grid;
    gap: 8px;
}

.switch-row label {
    display: flex;
    gap: 8px;
    align-items: center;
}

.switch-row input {
    width: auto;
}

.user-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    border-top: 1px solid var(--line);
    padding-top: 10px;
}

.user-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.table-card.embedded {
    border: 0;
    overflow-x: auto;
}

.filters input {
    min-width: 280px;
}

.status {
    display: inline-flex;
    align-items: center;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    background: #eef0f3;
}

.status.published,
.status.approved {
    background: #e8f7ee;
    color: #0f6843;
}

.status.submitted,
.status.in_editing,
.status.ready_for_director {
    background: #fff4df;
    color: #8a5200;
}

.status.rejected,
.status.archived,
.status.trashed {
    background: #fdecec;
    color: #a42f2f;
}

.editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 18px;
    align-items: start;
}

.editor-main {
    padding: 0;
    overflow: hidden;
}

.title-input,
.slug-input {
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
}

.title-input {
    font-size: 36px;
    font-weight: 850;
    padding: 20px;
}

.slug-input {
    color: var(--muted);
    padding: 12px 20px;
}

.editor-toolbar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    padding: 10px;
    background: #f8faf8;
    border-bottom: 1px solid var(--line);
}

.editor-toolbar button {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 6px;
    min-width: 38px;
    min-height: 36px;
    cursor: pointer;
}

.visual-editor {
    min-height: 620px;
    padding: 26px;
    outline: 0;
    font: 20px/1.65 Georgia, "Times New Roman", serif;
    background: #fff;
}

.visual-editor h2,
.visual-editor h3 {
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    line-height: 1.16;
}

.visual-editor blockquote {
    border-left: 5px solid var(--red);
    margin-left: 0;
    padding-left: 18px;
    color: #333;
}

.editor-main textarea {
    border-radius: 0;
    border-inline: 0;
    border-bottom: 0;
}

.editor-side {
    display: grid;
    gap: 14px;
}

.check-list {
    display: grid;
    gap: 8px;
    max-height: 230px;
    overflow: auto;
}

.check-list label {
    display: flex;
    gap: 8px;
    align-items: center;
}

.check-list input {
    width: auto;
}

.thumb-preview {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: 6px;
    margin: 10px 0;
}

.history-item {
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
}

.history-item span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.workflow-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(240px, 1fr));
    gap: 14px;
    overflow-x: auto;
}

.workflow-column {
    min-height: 520px;
}

.workflow-column h2 {
    font-size: 15px;
    text-transform: uppercase;
}

.workflow-card {
    padding: 14px;
    margin-bottom: 12px;
}

.workflow-card h3 {
    margin: 0 0 6px;
}

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

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.media-card {
    padding: 10px;
}

.media-card img,
.file-icon {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: grid;
    place-items: center;
    background: #e9eded;
    border-radius: 6px;
    color: var(--red);
    font-weight: 900;
}

.media-card code {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--muted);
    font-size: 12px;
}

.stack-form {
    display: grid;
    gap: 12px;
}

.narrow {
    max-width: 620px;
}

.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        linear-gradient(135deg, rgba(18, 108, 99, 0.92), rgba(177, 59, 59, 0.88)),
        url("../img/editorial-pattern.svg") center / cover;
}

.login-panel {
    width: min(92vw, 430px);
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
}

.login-panel h1 {
    font-size: 46px;
    margin: 4px 0;
}

.login-panel form {
    display: grid;
    gap: 14px;
}

@media (max-width: 1000px) {
    .admin-shell,
    .editor-layout,
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
    }

    .sidebar nav {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .workspace {
        padding: 16px;
    }

    .workspace-header,
    .toolbar,
    .filters,
    .inline-form {
        align-items: stretch;
        flex-direction: column;
    }

    .metrics {
        grid-template-columns: 1fr;
    }

    .title-input {
        font-size: 27px;
    }
}
