:root {
    --bg: #f3f0e8;
    --panel: #fffdf8;
    --panel-strong: #ffffff;
    --line: #e4d8c5;
    --line-soft: #efe5d7;
    --text: #1f1b16;
    --muted: #77695a;
    --brand: #b74f2a;
    --brand-soft: #f4e2d7;
    --success: #327a4b;
    --warn: #bb6c11;
    --danger: #9e3c30;
    --shadow: 0 18px 40px rgba(88, 59, 31, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(183, 79, 42, 0.08), transparent 28%),
        linear-gradient(180deg, #f7f2e7 0%, var(--bg) 100%);
    color: var(--text);
}

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

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

.sidebar {
    padding: 28px 22px;
    background: rgba(255, 252, 246, 0.92);
    border-right: 1px solid var(--line);
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--line-soft);
}

.brand-mark {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: linear-gradient(135deg, #cf6e3f, #8f3d22);
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.muted {
    color: var(--muted);
}

.small {
    font-size: 12px;
}

.nav {
    margin-top: 24px;
    display: grid;
    gap: 8px;
}

.nav a {
    padding: 12px 14px;
    border-radius: 14px;
    color: var(--text);
    font-weight: 600;
}

.nav a:hover,
.nav a.active {
    background: var(--brand-soft);
    color: var(--brand);
}

.content {
    padding: 30px;
}

.topbar {
    margin-bottom: 20px;
}

.topbar h1 {
    margin: 0 0 6px;
    font-size: 32px;
}

.card {
    background: rgba(255, 253, 248, 0.92);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 22px;
}

.inset-card {
    background: var(--panel-strong);
    border-radius: 18px;
    padding: 18px;
}

.stats-grid,
.grid.two-col {
    display: grid;
    gap: 18px;
    margin-bottom: 18px;
}

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

.grid.two-col {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
}

.stat-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 12px;
}

.stat-card strong {
    font-size: 34px;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 14px;
}

.section-head h2,
.card h2 {
    margin: 0;
    font-size: 20px;
}

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

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

.table th {
    font-size: 13px;
    text-transform: uppercase;
    color: var(--muted);
    letter-spacing: 0.04em;
}

.table tbody tr:hover {
    background: rgba(244, 226, 215, 0.28);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.status-pending {
    background: #fff0cb;
    color: #7d5800;
}

.status-processing {
    background: #d9eefb;
    color: #145b78;
}

.status-done,
.status-sent,
.status-enabled {
    background: #d9f2df;
    color: #1c6935;
}

.status-ignored,
.status-disabled,
.status-failed {
    background: #f3ddd8;
    color: #8c372d;
}

.priority-low {
    background: #edf2ef;
    color: #54645a;
}

.priority-medium {
    background: #f5ead8;
    color: #8c5b1f;
}

.priority-high {
    background: #f7d7c1;
    color: #9a4317;
}

.priority-urgent {
    background: #f3c3bd;
    color: #8e2718;
}

.source-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 14px;
}

.source-list li {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line-soft);
}

.filters,
.form-grid,
.stack,
.inline-form {
    display: grid;
    gap: 14px;
}

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

.form-row.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.checkbox-line {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 600;
}

.checkbox-line input {
    width: auto;
}

.filters {
    grid-template-columns: minmax(220px, 1.6fr) repeat(3, minmax(140px, 1fr)) auto;
    align-items: center;
}

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

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

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

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(183, 79, 42, 0.16);
    border-color: rgba(183, 79, 42, 0.5);
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 16px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #fff9f2;
    color: var(--text);
    cursor: pointer;
}

.button.primary,
button.primary {
    background: linear-gradient(135deg, #ca6235, #9d4220);
    color: #fff;
    border-color: transparent;
}

.detail-grid {
    align-items: start;
}

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

.detail-list div {
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line-soft);
}

.detail-list dt {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 13px;
}

.detail-list dd {
    margin: 0;
    font-weight: 600;
}

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

.timeline-item {
    padding: 14px 16px;
    border-radius: 16px;
    background: #fffdfa;
    border: 1px solid var(--line-soft);
}

.code-block {
    margin: 0;
    padding: 18px;
    background: #251f19;
    color: #f4ecdf;
    border-radius: 18px;
    overflow: auto;
    font-size: 13px;
    line-height: 1.6;
}

.pagination {
    margin-top: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.empty {
    color: var(--muted);
    text-align: center;
    padding: 26px 0;
}

.inline-form-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

@media (max-width: 1200px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .stats-grid,
    .grid.two-col,
    .filters,
    .detail-list,
    .form-row.three {
        grid-template-columns: 1fr;
    }
}
