:root {
    --sidebar-width: 255px;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active-bg: rgba(59,130,246,.15);
    --sidebar-active-text: #60a5fa;
    --sidebar-hover-bg: rgba(255,255,255,.05);
    --topbar-height: 60px;
    --topbar-bg: #ffffff;
    --content-bg: #f1f5f9;
    --card-bg: #ffffff;
    --primary: #3b82f6;
    --primary-dark: #2563eb;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--content-bg);
    color: #334155;
    margin: 0;
}

/* ── Wrapper ─────────────────────────────── */

.wrapper {
    display: flex;
    min-height: 100vh;
}

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

#sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform .25s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px;
    font-size: 1rem;
    font-weight: 700;
    color: #f1f5f9;
    border-bottom: 1px solid rgba(255,255,255,.06);
    text-decoration: none;
}

.sidebar-brand i {
    font-size: 1.3rem;
    color: var(--primary);
}

.sidebar-section-label {
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #475569;
    padding: 18px 18px 6px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 18px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: .875rem;
    font-weight: 500;
    border-radius: 6px;
    margin: 1px 8px;
    transition: all .15s ease;
}

.sidebar-link:hover {
    background: var(--sidebar-hover-bg);
    color: #cbd5e1;
}

.sidebar-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
}

.sidebar-link i {
    font-size: 1rem;
    width: 18px;
    text-align: center;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,.06);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-weight: 700;
    font-size: .85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-name {
    font-size: .8rem;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: .7rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Content ─────────────────────────────── */

#content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Topbar ──────────────────────────────── */

.topbar {
    height: var(--topbar-height);
    background: var(--topbar-bg);
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: #64748b;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    display: none;
}

.sidebar-toggle:hover { background: #f1f5f9; }

.page-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ── Main content ────────────────────────── */

.main-content {
    padding: 24px;
    flex: 1;
}

/* ── Stats cards ─────────────────────────── */

.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px 24px;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: box-shadow .2s ease;
}

.stat-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.08); }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-icon.blue   { background: #dbeafe; color: #2563eb; }
.stat-icon.green  { background: #dcfce7; color: #16a34a; }
.stat-icon.red    { background: #fee2e2; color: #dc2626; }
.stat-icon.yellow { background: #fef9c3; color: #ca8a04; }
.stat-icon.purple { background: #f3e8ff; color: #9333ea; }

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1;
}

.stat-label {
    font-size: .8rem;
    color: #64748b;
    margin-top: 2px;
}

/* ── Cards ───────────────────────────────── */

.card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: none;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid #f1f5f9;
    font-weight: 600;
    font-size: .875rem;
    padding: 14px 20px;
}

/* ── Tables ──────────────────────────────── */

.table th {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.table td {
    font-size: .875rem;
    vertical-align: middle;
    border-color: #f1f5f9;
}

.table tbody tr:hover { background: #f8fafc; }

/* ── Forms ───────────────────────────────── */

.form-label {
    font-weight: 500;
    font-size: .875rem;
    color: #374151;
}

.form-control, .form-select {
    border-color: #e2e8f0;
    border-radius: 8px;
    font-size: .875rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}

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

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* ── Login page ──────────────────────────── */

.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 60px rgba(0,0,0,.3);
}

.login-logo {
    font-size: 2rem;
    color: var(--primary);
    text-align: center;
    margin-bottom: 8px;
}

.login-title {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
}

.login-subtitle {
    text-align: center;
    color: #64748b;
    font-size: .875rem;
    margin-bottom: 28px;
}

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

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-dot.online  { background: #22c55e; box-shadow: 0 0 0 2px rgba(34,197,94,.2); }
.status-dot.offline { background: #ef4444; box-shadow: 0 0 0 2px rgba(239,68,68,.2); }
.status-dot.unknown { background: #94a3b8; }

/* ── Response time bar ───────────────────── */

.response-bar {
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
    overflow: hidden;
}

.response-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: #22c55e;
    transition: width .5s ease;
}

.response-bar-fill.slow { background: #f59e0b; }
.response-bar-fill.very-slow { background: #ef4444; }

/* ── FTP file browser ────────────────────── */

.file-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #f1f5f9;
    font-size: .875rem;
    cursor: pointer;
    transition: background .15s;
}

.file-item:hover { background: #f8fafc; }

.file-item i { margin-right: 8px; font-size: 1rem; }

.file-item .file-name { flex: 1; color: #374151; }
.file-item .file-size { color: #94a3b8; font-size: .75rem; }

/* ── Monitoring history ───────────────────── */

.check-log {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    font-size: .8rem;
    border-bottom: 1px solid #f1f5f9;
}

/* ── Quill editor ────────────────────────── */

.ql-container { border-radius: 0 0 8px 8px; border-color: #e2e8f0 !important; }
.ql-toolbar  { border-radius: 8px 8px 0 0; border-color: #e2e8f0 !important; }

/* ── Responsive ──────────────────────────── */

@media (max-width: 768px) {
    #sidebar {
        transform: translateX(-100%);
    }

    #sidebar.show {
        transform: translateX(0);
    }

    #content {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: block;
    }
}
