* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f1f5f9;
    color: #0f172a;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 220px;
    background: #0f172a;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.brand {
    padding: 24px 20px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    border-bottom: 1px solid #1e293b;
}
.brand small { font-size: 12px; font-weight: 400; color: #94a3b8; }
.nav-item {
    display: block;
    padding: 12px 20px;
    color: #cbd5e1;
    text-decoration: none;
}
.nav-item:hover, .nav-item.active {
    background: #1e293b;
    color: #fff;
    text-decoration: none;
}
.sidebar-foot {
    margin-top: auto;
    padding: 16px 20px;
    border-top: 1px solid #1e293b;
    font-size: 13px;
}
.user-name { margin-bottom: 8px; color: #f8fafc; }
.logout { color: #94a3b8; font-size: 12px; }

.main { flex: 1; min-width: 0; }
.page-header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 20px 28px;
}
.page-header h1 { margin: 0; font-size: 22px; }
.page-body { padding: 24px 28px; }

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.card {
    background: #fff;
    border-radius: 12px;
    padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(15,23,42,.08);
}
.card .label { font-size: 13px; color: #64748b; }
.card .value { font-size: 28px; font-weight: 700; margin-top: 6px; }

.panel {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(15,23,42,.08);
    margin-bottom: 20px;
}
.panel h2 { margin: 0 0 16px; font-size: 16px; }

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
    align-items: flex-end;
}
.filter-bar label {
    display: flex;
    flex-direction: column;
    font-size: 12px;
    color: #64748b;
    gap: 4px;
}
.filter-bar input, .filter-bar select {
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    min-width: 140px;
}
.btn {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 8px;
    border: none;
    background: #2563eb;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: #1d4ed8; text-decoration: none; color: #fff; }
.btn-secondary { background: #e2e8f0; color: #0f172a; }
.btn-secondary:hover { background: #cbd5e1; color: #0f172a; }
.btn-danger { background: #dc2626; }
.btn-danger:hover { background: #b91c1c; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th, .data-table td {
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 8px;
    text-align: left;
    vertical-align: top;
}
.data-table th { color: #64748b; font-weight: 600; background: #f8fafc; }
.data-table.compact td code { font-size: 12px; word-break: break-all; }

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    background: #e0f2fe;
    color: #0369a1;
}
.tag.offline { background: #fee2e2; color: #b91c1c; }

.pagination { margin-top: 16px; display: flex; gap: 6px; flex-wrap: wrap; }
.page-link {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #334155;
    text-decoration: none;
}
.page-link.active { background: #2563eb; color: #fff; border-color: #2563eb; }

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a, #1e3a5f);
}
.login-card {
    width: 380px;
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.login-card h1 { margin: 0 0 8px; font-size: 22px; }
.login-card p { margin: 0 0 24px; color: #64748b; font-size: 14px; }
.login-card label { display: block; margin-bottom: 14px; font-size: 13px; color: #475569; }
.login-card input {
    width: 100%;
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 15px;
}
.login-card .btn { width: 100%; margin-top: 8px; }
.alert-error {
    background: #fef2f2;
    color: #b91c1c;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}
.alert-success {
    background: #f0fdf4;
    color: #15803d;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}
.form-grid label {
    display: flex;
    flex-direction: column;
    font-size: 13px;
    color: #475569;
    gap: 6px;
}
.form-grid label.full-width { grid-column: 1 / -1; }
.form-grid input, .form-grid select, .form-grid textarea {
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}
.form-grid textarea { resize: vertical; min-height: 80px; }
.checkbox-label {
    flex-direction: row !important;
    align-items: center;
    gap: 8px !important;
}
.checkbox-label input { width: auto; }

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}
.row-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.release-notes-row {
    font-size: 13px;
    color: #64748b;
    background: #f8fafc;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.detail-item {
    background: #f8fafc;
    border-radius: 8px;
    padding: 12px;
}
.detail-item .k { font-size: 12px; color: #64748b; }
.detail-item .v { margin-top: 4px; font-weight: 600; word-break: break-all; }

.snapshot-section { margin-bottom: 16px; }
.snapshot-section h3 { margin: 0 0 8px; font-size: 14px; }
.snapshot dl { margin: 0; display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 13px; }
.snapshot dt { color: #64748b; }
.snapshot dd { margin: 0; }

.code {
    background: #0f172a;
    color: #e2e8f0;
    padding: 12px;
    border-radius: 8px;
    overflow: auto;
    font-size: 12px;
    line-height: 1.5;
}
.muted { color: #94a3b8; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

@media (max-width: 900px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; }
}
