* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 24px;
    color: #1f2933;
    background: #f3f5f8;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

a {
    color: #2563a9;
    text-decoration: none;
}

a:hover { text-decoration: underline; }

.shell {
    max-width: 1360px;
    margin: 0 auto;
}

.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 24px 28px;
    background: #fff;
    border: 1px solid #e1e7ef;
    border-radius: 8px;
}

.login-box {
    max-width: 380px;
    margin-top: 12vh;
}

.topbar,
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.topbar h1,
.header h1,
.container h1 {
    margin: 0;
    font-size: 24px;
    line-height: 1.25;
}

.topbar p {
    margin: 6px 0 0;
    color: #687385;
    font-size: 13px;
}

.userbar {
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}

.btn,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 8px 14px;
    color: #fff;
    background: #2563a9;
    border: 1px solid #2563a9;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.btn.secondary {
    color: #334155;
    background: #fff;
    border-color: #cbd5e1;
}

button:hover,
.btn:hover {
    background: #1d4f87;
    text-decoration: none;
}

.btn.secondary:hover {
    background: #f8fafc;
}

.notice,
.error {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 6px;
}

.notice {
    color: #166534;
    background: #e8f7ee;
    border: 1px solid #bbdfc8;
}

.error {
    color: #991b1b;
    background: #fdecec;
    border: 1px solid #f4b7b7;
}

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

.metric {
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #e1e7ef;
    border-radius: 8px;
}

.metric span {
    display: block;
    color: #687385;
    font-size: 13px;
}

.metric strong {
    display: block;
    margin-top: 6px;
    font-size: 26px;
    line-height: 1;
}

.dashboard {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.side-column,
.main-column {
    display: grid;
    gap: 16px;
}

.panel {
    background: #fff;
    border: 1px solid #e1e7ef;
    border-radius: 8px;
    overflow: hidden;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #edf1f5;
}

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

.panel h3 {
    margin: 0 0 10px;
    font-size: 15px;
}

.online-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px;
    min-height: 58px;
}

.pill,
.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
}

.pill {
    padding: 7px 10px;
    color: #1f2937;
    background: #eef4fb;
    border: 1px solid #d7e4f3;
}

.badge {
    padding: 5px 8px;
    font-weight: 600;
}

.badge.ok {
    color: #166534;
    background: #dcfce7;
}

.badge.off {
    color: #991b1b;
    background: #fee2e2;
}

.badge.warn {
    color: #92400e;
    background: #fef3c7;
}

form {
    margin: 0;
}

.stack-form {
    display: grid;
    gap: 8px;
    padding: 16px;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px;
    border-bottom: 1px solid #edf1f5;
}

.inline-form.compact {
    border-top: 1px solid #edf1f5;
    border-bottom: none;
}

label {
    color: #4b5563;
    font-size: 13px;
}

input,
select {
    min-height: 36px;
    padding: 8px 10px;
    color: #111827;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    font-size: 14px;
}

.stack-form input,
.stack-form select,
.stack-form button {
    width: 100%;
}

.inline-form input[type="text"],
.inline-form input[type="password"] {
    min-width: 210px;
    flex: 1;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th,
td {
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid #edf1f5;
    white-space: nowrap;
}

th {
    color: #526071;
    background: #f8fafc;
    font-weight: 600;
}

tr:hover td {
    background: #fbfdff;
}

.actions {
    display: flex;
    gap: 12px;
}

.danger {
    color: #b42318;
}

.expired {
    color: #b42318;
}

.resource-block {
    padding: 14px 16px;
    border-top: 1px solid #edf1f5;
}

.resource-block:first-of-type {
    border-top: none;
}

.resource-title {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.resource-title span,
em {
    color: #687385;
    font-size: 13px;
}

.resource-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.resource-list li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 10px;
    align-items: center;
    padding: 7px 0;
    border-top: 1px solid #f0f3f7;
}

.resource-list li:first-child {
    border-top: none;
}

.resource-list span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 980px) {
    body {
        padding: 14px;
    }

    .topbar,
    .header {
        align-items: flex-start;
        flex-direction: column;
    }

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

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

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

    .inline-form {
        display: grid;
    }

    .inline-form input,
    .inline-form select,
    .inline-form button {
        width: 100%;
    }
}
