:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --text: #16202a;
    --muted: #637083;
    --line: #d8dee7;
    --primary: #1b74e4;
    --primary-dark: #155dbc;
    --danger: #bf2f24;
    --success: #137c43;
    --warning: #9a6500;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

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

.topbar {
    align-items: center;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 24px;
    min-height: 64px;
    padding: 0 28px;
}

.brand {
    color: var(--text);
    font-size: 20px;
    font-weight: 700;
}

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-left: auto;
}

.nav a {
    color: var(--muted);
    font-weight: 600;
}

.container {
    margin: 0 auto;
    max-width: 1180px;
    padding: 28px;
}

h1 {
    font-size: 30px;
    margin: 0 0 22px;
}

h2 {
    font-size: 19px;
    margin: 0 0 18px;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
}

.narrow {
    max-width: 460px;
}

.grid {
    display: grid;
    gap: 22px;
}

.grid.two {
    grid-template-columns: minmax(320px, 430px) 1fr;
}

.metrics {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    margin-bottom: 22px;
}

.metric {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.metric strong {
    display: block;
    font-size: 30px;
}

.metric span,
label span,
.list-item span,
small {
    color: var(--muted);
}

.actions {
    display: flex;
    gap: 12px;
    margin-bottom: 22px;
}

.form {
    display: grid;
    gap: 16px;
}

label {
    display: grid;
    gap: 7px;
    font-weight: 700;
}

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

textarea {
    resize: vertical;
}

.check {
    align-items: center;
    display: flex;
    gap: 9px;
}

.check input {
    width: auto;
}

.button {
    align-items: center;
    background: #eef2f7;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 700;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px;
}

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

.button.primary:hover {
    background: var(--primary-dark);
}

.button.danger {
    background: #ffe9e7;
    color: var(--danger);
}

.button.small {
    min-height: 32px;
    padding: 5px 10px;
}

.flash {
    border-radius: 8px;
    margin-bottom: 18px;
    padding: 12px 14px;
}

.flash-success {
    background: #e8f6ee;
    color: var(--success);
}

.flash-error {
    background: #fff0ee;
    color: var(--danger);
}

.table-wrap {
    overflow-x: auto;
}

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

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

.list {
    display: grid;
    gap: 12px;
}

.list-item {
    align-items: flex-start;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    gap: 14px;
    justify-content: space-between;
    padding: 14px;
}

.list-item strong,
.list-item span,
.list-item small {
    display: block;
}

.post-copy {
    min-width: 0;
}

.post-copy p {
    margin: 8px 0;
    overflow-wrap: anywhere;
}

.row-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.status {
    border-radius: 999px;
    display: inline-flex;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 9px;
    text-transform: uppercase;
}

.status-queued {
    background: #edf3ff;
    color: var(--primary-dark);
}

.status-publishing {
    background: #fff6df;
    color: var(--warning);
}

.status-published {
    background: #e8f6ee;
    color: var(--success);
}

.status-failed {
    background: #fff0ee;
    color: var(--danger);
}

.error-text {
    color: var(--danger);
}

pre {
    background: #101820;
    border-radius: 8px;
    color: #f8fbff;
    overflow-x: auto;
    padding: 16px;
}

@media (max-width: 840px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
        padding: 16px;
    }

    .nav {
        margin-left: 0;
    }

    .container {
        padding: 18px;
    }

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

    .list-item {
        display: grid;
    }

    .row-actions {
        justify-content: flex-start;
    }
}
