* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f6f7f4;
    color: #1d2520;
    font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: #245f73;
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: center;
    padding: 16px clamp(20px, 4vw, 56px);
    background: #173b3f;
    color: #fff;
}

.brand {
    color: #fff;
    font-weight: 700;
    text-decoration: none;
}

.topbar nav {
    display: flex;
    gap: 16px;
}

.topbar nav a {
    color: #dceee7;
}

main {
    width: min(1180px, calc(100% - 32px));
    margin: 32px auto 64px;
}

.page-head {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: start;
    margin-bottom: 24px;
}

h1,
h2 {
    margin: 0 0 8px;
    line-height: 1.2;
}

p {
    margin: 0 0 12px;
}

code {
    background: #e8ece6;
    padding: 2px 5px;
    border-radius: 4px;
}

.toolbar,
.editor,
.agents,
.panel,
.metric {
    background: #fff;
    border: 1px solid #d8ddd5;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

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

.toolbar form {
    grid-template-columns: minmax(220px, 1fr) 180px auto;
    align-items: end;
}

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

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

.metric {
    display: grid;
    gap: 4px;
}

.metric strong {
    color: #173b3f;
    font-size: 36px;
    line-height: 1;
}

.metric span {
    color: #617066;
}

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

.plan-source {
    border-left: 4px solid #245f73;
    padding-left: 14px;
    margin-bottom: 18px;
}

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

.plan-list li {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 14px;
    border-top: 1px solid #e1e5de;
    padding-top: 12px;
}

.plan-list small {
    color: #617066;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 650;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #c3cbc0;
    border-radius: 6px;
    padding: 10px 12px;
    color: #1d2520;
    font: inherit;
}

textarea {
    resize: vertical;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 1px solid #245f73;
    border-radius: 6px;
    background: #245f73;
    color: #fff;
    padding: 8px 14px;
    font: inherit;
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
}

.button {
    background: #fff;
    color: #245f73;
}

.button.primary {
    background: #245f73;
    color: #fff;
}

.actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.errors {
    border: 1px solid #b84a4a;
    background: #fff1f1;
    color: #6f1d1d;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 16px;
}

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

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

th {
    color: #506157;
    font-size: 13px;
    text-transform: uppercase;
}

td span {
    display: block;
    color: #617066;
    font-size: 14px;
}

.status {
    display: inline-block;
    border-radius: 999px;
    padding: 3px 9px;
    background: #e8ece6;
    color: #344238;
    font-size: 13px;
}

.status.active {
    background: #dceee7;
    color: #164c3c;
}

.status.inactive {
    background: #ece8dc;
    color: #5a4723;
}

.status.retired {
    background: #eee1e1;
    color: #6a2c2c;
}

.status.decided,
.status.complete {
    background: #dceee7;
    color: #164c3c;
}

.status.next {
    background: #dce8ee;
    color: #17465a;
}

.status.open,
.status.paused {
    background: #ece8dc;
    color: #5a4723;
}

.status.blocked {
    background: #eee1e1;
    color: #6a2c2c;
}

.row-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.row-actions form {
    margin: 0;
}

.row-actions button {
    min-height: auto;
    border: 0;
    background: transparent;
    color: #8a2f2f;
    padding: 0;
}

.empty {
    color: #617066;
}

@media (max-width: 760px) {
    .topbar,
    .page-head,
    .row-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .toolbar form,
    .grid.two,
    .dashboard-grid,
    .plan-list li {
        grid-template-columns: 1fr;
    }

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

    table,
    thead,
    tbody,
    tr,
    th,
    td {
        display: block;
    }

    thead {
        display: none;
    }

    td {
        padding: 10px 0;
    }
}
