* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: #172033;
    background: #f5f7fb;
    font-family: Arial, Helvetica, sans-serif;
}

.layout {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 28px 0 18px;
}

.topbar span {
    display: block;
    margin-bottom: 6px;
    color: #637083;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
}

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

nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

nav a,
.button {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid #cfd7e6;
    border-radius: 6px;
    color: #172033;
    background: #fff;
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
}

nav a.active,
.button.primary {
    border-color: #2757d7;
    color: #fff;
    background: #2757d7;
}

main {
    display: grid;
    gap: 18px;
    padding-bottom: 40px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.panel,
.card,
.stat {
    border: 1px solid #dce3ef;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(32, 44, 70, .06);
}

.panel {
    padding: 20px;
}

.stat {
    padding: 18px;
}

.stat span {
    display: block;
    margin-bottom: 8px;
    color: #657184;
    font-size: 13px;
}

.stat strong {
    font-size: 28px;
}

.actions,
.form-actions,
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

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

.full {
    grid-column: 1 / -1;
}

label {
    display: block;
    margin-bottom: 6px;
    color: #4f5b70;
    font-size: 13px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid #cbd4e2;
    border-radius: 6px;
    color: #172033;
    background: #fff;
    font: inherit;
}

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

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

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

th {
    color: #526072;
    font-size: 13px;
}

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

.badge {
    display: inline-flex;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.badge.ok {
    color: #136b38;
    background: #dff6e8;
}

.badge.no {
    color: #9f1f2f;
    background: #ffe1e6;
}

.badge.wait {
    color: #7b5a08;
    background: #fff1c7;
}

.notice {
    padding: 12px 14px;
    border-radius: 6px;
    background: #eef5ff;
}

.danger {
    border-color: #f2bcc4;
    background: #fff4f6;
}

.button.danger {
    border-color: #c43345;
    color: #9f1f2f;
    background: #fff4f6;
}

.button.danger:hover {
    background: #ffe1e6;
}

.muted {
    color: #667085;
}

details.card {
    padding: 16px;
}

summary {
    cursor: pointer;
    font-weight: 700;
}

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

.tab-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: flex-end;
    margin: 4px 0 18px;
    padding: 4px 4px 0;
    border-bottom: 1px solid #cfd7e6;
    background: linear-gradient(#f8fafd, #eef3fa);
    border-radius: 8px 8px 0 0;
}

.tab-buttons a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    margin: 0 0 -1px 0;
    padding: 0 18px;
    border: 1px solid #cfd7e6;
    border-bottom-color: #cfd7e6;
    border-radius: 7px 7px 0 0;
    color: #526072;
    background: #eef3fa;
    cursor: pointer;
    text-decoration: none;
    font-weight: 700;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .8);
}

.tab-buttons a.active {
    position: relative;
    border-color: #cfd7e6;
    border-bottom-color: #fff;
    color: #2757d7;
    background: #fff;
    box-shadow: 0 -2px 8px rgba(32, 44, 70, .05);
}

.tab-buttons a.active::after {
    position: absolute;
    right: 0;
    bottom: -2px;
    left: 0;
    height: 3px;
    background: #fff;
    content: "";
}

.tab-buttons a:not(.active):hover {
    color: #172033;
    background: #f8fafd;
}

.tab-panel {
    display: block;
}

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

.link-summary > div {
    padding: 14px;
    border: 1px solid #dce3ef;
    border-radius: 6px;
    background: #f8fafd;
}

.link-summary span {
    display: block;
    margin-bottom: 8px;
    color: #657184;
    font-size: 13px;
    font-weight: 700;
}

.link-summary strong:not(.badge) {
    display: block;
}

@media (max-width: 760px) {
    .topbar,
    .form-grid,
    .grid,
    .link-summary {
        grid-template-columns: 1fr;
        display: grid;
    }

    .topbar {
        align-items: start;
    }
}
