:root {
    --cs-primary: #4f46e5;
    --cs-primary-dark: #4338ca;
    --cs-sidebar-bg: #111827;
    --cs-sidebar-hover: #1f2937;
    --cs-sidebar-active: #4f46e5;
    --cs-body-bg: #f4f6fb;
    --cs-border: #e5e7eb;
    --cs-radius: 12px;
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--cs-body-bg);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 0.925rem;
    color: #1f2937;
}

a {
    text-decoration: none;
}

/* ---------------------------------------------------------------- Layout */
.cs-app {
    display: flex;
    min-height: 100vh;
}

.cs-sidebar {
    width: 250px;
    flex-shrink: 0;
    background: var(--cs-sidebar-bg);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    transition: transform 0.25s ease;
    overflow-y: auto;
}

.cs-sidebar__brand {
    padding: 1rem 1.15rem;
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    min-height: 60px;
}

.cs-sidebar__brand small {
    display: block;
    font-size: 0.68rem;
    font-weight: 400;
    color: #94a3b8;
}

.cs-nav {
    padding: 0.6rem 0.6rem 2rem;
    flex: 1;
}

.cs-nav__title {
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    padding: 1rem 0.75rem 0.35rem;
    font-weight: 600;
}

.cs-nav__link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0.75rem;
    color: #cbd5e1;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 2px;
    transition: background 0.15s, color 0.15s;
}

.cs-nav__link:hover {
    background: var(--cs-sidebar-hover);
    color: #fff;
}

.cs-nav__link.active {
    background: var(--cs-sidebar-active);
    color: #fff;
    font-weight: 500;
}

.cs-nav__link i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
}

.cs-nav__link.disabled {
    opacity: 0.45;
    pointer-events: none;
}

.cs-main {
    flex: 1;
    margin-left: 250px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.cs-topbar {
    height: 60px;
    background: #fff;
    border-bottom: 1px solid var(--cs-border);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.25rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.cs-content {
    padding: 1.5rem;
    flex: 1;
}

.cs-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1035;
}

/* --------------------------------------------------------------- Cards */
.cs-card {
    background: #fff;
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.cs-card__header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--cs-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.cs-card__title {
    font-size: 0.98rem;
    font-weight: 600;
    margin: 0;
}

.cs-card__body {
    padding: 1.25rem;
}

.cs-stat {
    background: #fff;
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    padding: 1.1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 100%;
}

.cs-stat__icon {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.cs-stat__label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.cs-stat__value {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.1;
}

/* -------------------------------------------------------------- Tables */
.cs-table {
    width: 100%;
    margin: 0;
}

.cs-table th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    font-weight: 600;
    background: #f9fafb;
    border-bottom: 1px solid var(--cs-border);
    padding: 0.7rem 0.9rem;
    white-space: nowrap;
}

.cs-table td {
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.cs-table tbody tr:hover {
    background: #fafbff;
}

.cs-table-responsive {
    overflow-x: auto;
}

/* ------------------------------------------------------------- Buttons */
.btn {
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
}

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

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

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
}

/* --------------------------------------------------------------- Forms */
.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.3rem;
}

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

.form-control:focus,
.form-select:focus {
    border-color: var(--cs-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.required::after {
    content: " *";
    color: #dc2626;
}

/* --------------------------------------------------------------- Badges */
.badge {
    font-weight: 600;
    font-size: 0.7rem;
    padding: 0.35em 0.6em;
    border-radius: 6px;
}

/* ----------------------------------------------------------- Auth pages */
.cs-auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #2563eb 100%);
    padding: 1.5rem;
}

.cs-auth__card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.25);
    padding: 2rem;
}

.cs-auth__logo {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--cs-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin: 0 auto 1rem;
}

/* ---------------------------------------------------------- Installer */
.cs-install {
    min-height: 100vh;
    background: var(--cs-body-bg);
    padding: 2rem 1rem;
}

.cs-install__wrapper {
    max-width: 820px;
    margin: 0 auto;
}

.cs-steps {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.cs-step {
    flex: 1;
    min-width: 90px;
    text-align: center;
    font-size: 0.72rem;
    color: #94a3b8;
    padding-top: 0.5rem;
    border-top: 3px solid #e2e8f0;
}

.cs-step.active {
    color: var(--cs-primary);
    border-top-color: var(--cs-primary);
    font-weight: 600;
}

.cs-step.done {
    color: #16a34a;
    border-top-color: #16a34a;
}

.cs-check {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid #f1f5f9;
}

/* ---------------------------------------------------------- Utilities */
.cs-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: #94a3b8;
}

.cs-empty i {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.text-muted-sm {
    font-size: 0.78rem;
    color: #6b7280;
}

.cs-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--cs-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
}

/* -------------------------------------------------------- Responsive */
@media (max-width: 991.98px) {
    .cs-sidebar {
        transform: translateX(-100%);
    }

    .cs-sidebar.open {
        transform: translateX(0);
    }

    .cs-main {
        margin-left: 0;
    }

    .cs-backdrop.show {
        display: block;
    }

    .cs-content {
        padding: 1rem;
    }
}
