:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-body: #f3f4f6;
    --bg-card: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --sidebar-width: 260px;
    --header-height: 64px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar & Navigation */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    position: fixed;
    height: 100%;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
    display: none;
    backdrop-filter: blur(2px);
}

.brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
}

.sys-name {
    margin-left: 0.5rem;
}

.nav-menu {
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 0.5rem;
    transition: all 0.2s;
    font-weight: 500;
}

.nav-item:hover,
.nav-item.active {
    background-color: #eff6ff;
    color: var(--primary-color);
}

.nav-item i {
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

.header {
    height: var(--header-height);
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Dashboard & Layout Components */
.container {
    padding: 2rem;
}

.container-fluid {
    width: 100%;
}

.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--bg-card);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-title {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
}

.stats-up {
    color: var(--success);
    font-size: 0.875rem;
}

.stats-down {
    color: var(--danger);
    font-size: 0.875rem;
}

/* Tables */
.table-container {
    background: var(--bg-card);
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.btn-secondary {
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: #f9fafb;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

td {
    font-size: 0.875rem;
}

.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Registration Form Layouts */
.registration-row-3col {
    display: grid;
    grid-template-columns: 200px 150px 150px;
    gap: 20px;
}

.registration-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* RESPONSIVE DESIGN (MOBILE FIRST OVERRIDES) */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.15);
    }

    .main-content {
        margin-left: 0 !important;
    }

    .header {
        height: 56px;
        padding: 0 1rem;
    }

    #menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: #f3f4f6;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        cursor: pointer;
        color: var(--text-main);
    }

    .p-2rem {
        padding: 1rem;
    }

    .user-profile span {
        display: none;
    }

    .grid-cards {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Table to Card Transformation */
    .table-container thead {
        display: none;
    }

    .table-container table,
    .table-container tbody,
    .table-container tr,
    .table-container td {
        display: block;
        width: 100%;
    }

    .table-container tr {
        background: white;
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: 12px;
        padding: 0.5rem;
    }

    .table-container td {
        border-bottom: 1px solid #f9fafb;
        position: relative;
        padding-left: 45% !important;
        text-align: right;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: flex-end;
    }

    .table-container td:last-child {
        border-bottom: none;
    }

    .table-container td:before {
        content: attr(data-label);
        position: absolute;
        left: 1rem;
        width: 40%;
        text-align: left;
        font-weight: 700;
        color: var(--text-muted);
        font-size: 0.7rem;
        text-transform: uppercase;
    }

    /* Form Adjustments */
    .registration-row-3col,
    .registration-row-2col {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .btn-primary,
    .btn-secondary,
    .form-control,
    select,
    .nav-item {
        min-height: 48px;
        font-size: 16px !important;
    }
}