*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f9fafb;
    color: #111827;
    font-size: 14px;
    line-height: 1.5;
}

/* ── Header ──────────────────────────────────────────── */

.header {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    height: 56px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #111827;
}

/* ── Buttons ─────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    border: none;
    line-height: 1;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-ghost {
    background: transparent;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-ghost:hover {
    background: #f3f4f6;
}

.btn-full {
    width: 100%;
    justify-content: center;
    padding: 9px 14px;
    font-size: 14px;
}

/* ── Login Page ──────────────────────────────────────── */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
}

.login-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 36px 40px;
    width: 360px;
}

.login-title {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 2px;
}

.login-subtitle {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 28px;
}

.form-group {
    margin-bottom: 14px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 5px;
}

.form-input {
    width: 100%;
    padding: 8px 11px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    color: #111827;
    background: #fff;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-submit {
    margin-top: 8px;
}

.error-msg {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    border-radius: 6px;
    padding: 9px 13px;
    font-size: 13px;
    margin-bottom: 16px;
}

/* ── Dashboard Layout ────────────────────────────────── */

.layout {
    display: flex;
    min-height: calc(100vh - 56px);
}

/* ── Sidebar ─────────────────────────────────────────── */

.sidebar {
    width: 200px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #e5e7eb;
    padding: 12px 0;
    position: sticky;
    top: 56px;
    height: calc(100vh - 56px);
    overflow-y: auto;
}

.sidebar-item {
    display: block;
    padding: 9px 20px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
}

.sidebar-item:hover {
    background: #f3f4f6;
    color: #111827;
}

.sidebar-item.active {
    background: #eff6ff;
    color: #2563eb;
}

.main {
    flex: 1;
    min-width: 0;
    padding: 24px;
}

/* ── Stats Row ───────────────────────────────────────── */

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

.stat-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 18px 20px;
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.03em;
    line-height: 1;
}

.stat-value.online {
    color: #16a34a;
}

/* ── Table Container ─────────────────────────────────── */

.table-wrap {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.table-top {
    padding: 14px 18px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.table-top-title {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
}

.refresh-label {
    font-size: 12px;
    color: #9ca3af;
}

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

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

thead th {
    background: #f9fafb;
    padding: 9px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

tbody td {
    padding: 11px 16px;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
    font-size: 13px;
    white-space: nowrap;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover td {
    background: #fafafa;
}

.server-name {
    font-weight: 600;
    color: #111827;
}

/* ── Status ──────────────────────────────────────────── */

.status-cell {
    display: flex;
    align-items: center;
    gap: 7px;
}

.dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot-green { background: #16a34a; }
.dot-red   { background: #dc2626; }
.dot-gray  { background: #9ca3af; }
.dot-amber { background: #d97706; }

/* ── Resource meters ─────────────────────────────────── */

.metric {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.metric-val {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
}

.bar {
    width: 72px;
    height: 3px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 2px;
    background: #2563eb;
    transition: width 0.4s ease;
}

.bar-fill.warn   { background: #d97706; }
.bar-fill.danger { background: #dc2626; }

/* ── Misc ────────────────────────────────────────────── */

.muted {
    color: #9ca3af;
}

.empty-row td {
    text-align: center;
    padding: 40px;
    color: #9ca3af;
}
