:root {
    --bg: #eff4ff;
    --surface: #ffffff;
    --surface-strong: #f8fbff;
    --text: #111827;
    --muted: #6b7280;
    --border: rgba(148, 163, 184, 0.24);
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-soft: #eef2ff;
    --danger: #dc2626;
    --shadow: 0 24px 80px rgba(15, 23, 42, 0.08);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color-scheme: light;
    color: var(--text);
    background: radial-gradient(circle at top, rgba(99, 102, 241, .12), transparent 32%), linear-gradient(180deg, #f8fbff 0%, #e2e8f0 100%);
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    min-height: 100%;
    color: var(--text);
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(circle farthest-side at 20% 10%, rgba(79, 70, 229, .14), transparent 28%),
    radial-gradient(circle farthest-side at 85% 6%, rgba(34, 197, 94, .08), transparent 24%);
    pointer-events: none;
    z-index: -1;
}

a {
    color: inherit;
    text-decoration: none;
}

button, input, select, textarea {
    font: inherit;
}

img {
    max-width: 100%;
    display: block;
}

code {
    background: grey;
    padding: 5px;
    border-radius: 6px;
    color: white;
    font-size: 12px;
}

/* Structural Page Framing Layouts */
.page-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    min-height: 100vh;
}

.page-wrapper.authenticated {
    grid-template-columns: 280px 1fr;
}

/* Mobile Overlay Menu Controls */
#menu-toggle {
    display: none;
}

.menu-btn {
    display: none;
}

/* Sidebar Architecture */
.sidebar {
    /*background: rgb(248 244 239);*/
    background: rgb(248 244 239);
    color: #000;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    border-right: 1px solid rgba(148, 163, 184, 0.16);
}

.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.sidebar .brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    display: grid;
    place-items: center;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 14px 30px rgba(79, 70, 229, 0.2);
}

.sidebar .brand-title {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.sidebar .brand-subtitle {
    color: #94a3b8;
    font-size: 0.88rem;
    line-height: 1.4;
}

.sidebar nav {
    display: grid;
    gap: 6px;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
    padding-right: 4px;
}

/* Custom mini scrollbar for sidebar nav if items overflow */
.sidebar nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.sidebar a, .sidebar nav form button {
    display: block;
    width: 100%;
    text-align: left;
    border-radius: 16px;
    padding: 13px 16px;
    background: transparent;
    border: 1px solid transparent;
    color: #000;
    font-size: 0.96rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.sidebar a:hover, .sidebar nav form button:hover {
    background: rgba(79, 68, 51, 0.50);
    color: #f8fafc;
}

.sidebar a.active {
    background: rgba(79, 68, 51, 0.78);
    border-color: rgba(79, 68, 51, 0.32);
    color: #fff;
}

.sidebar .spacer {
    flex: 1;
}

/* Main Workspace Canvas */
.content {
    background: transparent;
    min-width: 0;
}

.topbar {
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 22px 28px;
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(12px);
}

.topbar .topbar-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.topbar .topbar-label {
    color: #64748b;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.topbar .topbar-title {
    font-size: 1.15rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.topbar .topbar-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.page-body {
    padding: 32px;
    max-width: 1320px;
    margin: 0 auto;
    width: 100%;
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 28px;
}

.page-header h1 {
    margin: 0;
    font-size: clamp(1.75rem, 2.5vw, 2.5rem);
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.page-header .page-meta {
    color: var(--muted);
    font-size: 0.99rem;
    max-width: 680px;
    margin-top: 4px;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Layout Elements */
.card {
    background: var(--surface);
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 28px;
    box-shadow: var(--shadow);
    padding: clamp(20px, 3vw, 28px);
    margin-bottom: 26px;
}

.section {
    margin-bottom: 24px;
}

/* Form Layout Infrastructure */
.form-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.form-field {
    display: grid;
    gap: 10px;
}

.form-field label {
    font-weight: 600;
    color: #334155;
    font-size: 0.95rem;
}

.form-field input, .form-field select, .form-field textarea {
    width: 100%;
    min-height: 46px;
    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 16px;
    padding: 14px 16px;
    background: var(--surface-strong);
    color: var(--text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
    outline: none;
    border-color: rgba(79, 70, 229, 0.48);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.08);
}

.form-field textarea {
    min-height: 130px;
    resize: vertical;
}

.btn-primary, .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    border-radius: 16px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    font-weight: 500;
    text-align: center;
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    box-shadow: 0 16px 32px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 20px 36px rgba(79, 70, 229, 0.24);
}

.btn-secondary {
    color: #334155;
    background: #f8fafc;
    border: 1px solid rgba(148, 163, 184, 0.28);
}

.btn-secondary:hover {
    background: #eef2ff;
    transform: translateY(-1px);
}

.alert {
    border-radius: 20px;
    padding: 20px 22px;
    margin-bottom: 22px;
    font-size: 0.98rem;
}

.alert.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* Responsive Adaptive Table Core Architecture */
.table-responsive-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 18px;
    border-radius: 18px;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.table th, .table td {
    padding: 16px 18px;
    background: rgba(255, 255, 255, 0.9);
    border-top: 1px solid rgba(148, 163, 184, 0.12);
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.table th {
    color: #334155;
    font-weight: 700;
    background: #f8fafc;
    border: none;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    text-align: left;
}

.table th:first-child, .table td:first-child {
    border-left: 1px solid rgba(148, 163, 184, 0.12);
    border-top-left-radius: 14px;
    border-bottom-left-radius: 14px;
}

.table th:last-child, .table td:last-child {
    border-right: 1px solid rgba(148, 163, 184, 0.12);
    border-top-right-radius: 14px;
    border-bottom-right-radius: 14px;
}

.table tbody tr:hover td {
    background: #eef2ff;
}

.inline-actions {
    display: inline-flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.inline-actions a, .inline-actions button {
    font-size: 0.95rem;
    color: #4f46e5;
    background: transparent;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

.inline-actions button {
    padding: 0;
}

.text-muted {
    color: var(--muted);
}

.text-highlight {
    color: var(--primary);
    font-weight: 600;
}

/* Mobile Breakpoint Modifications */
@media (max-width: 1024px) {
    .page-wrapper.authenticated {
        grid-template-columns: 1fr;
    }

    /* Sliding Drawer Logic Engine */
    .sidebar {
        position: fixed;
        top: 0;
        left: -300px;
        width: 280px;
        height: 100vh;
        z-index: 100;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 20px 0 60px rgba(15, 23, 42, 0.25);
    }

    #menu-toggle:checked ~ .sidebar {
        transform: translateX(300px);
    }

    /* Responsive Backdrop overlay effect when menu drawer is open */
    #menu-toggle:checked ~ .content::after {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.4);
        backdrop-filter: blur(4px);
        z-index: 90;
    }

    /* Responsive Mobile Menu Bars Icon button */
    .menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border-radius: 12px;
        background: #f1f5f9;
        border: 1px solid rgba(148, 163, 184, 0.2);
        cursor: pointer;
        z-index: 110;
    }

    .menu-btn span {
        position: relative;
        width: 20px;
        height: 2px;
        background: #334155;
    }

    .menu-btn span::before, .menu-btn span::after {
        content: '';
        position: absolute;
        width: 20px;
        height: 2px;
        background: #334155;
        left: 0;
    }

    .menu-btn span::before {
        top: -6px;
    }

    .menu-btn span::after {
        bottom: -6px;
    }

    .topbar {
        padding: 16px 20px;
    }

    .page-body {
        padding: 20px 16px;
    }

    /* Mobile Form Field optimization fallback */
    .form-grid {
        grid-template-columns: 1fr;
    }

    /* Modern Adaptive Stacked Layout Matrix Strategy for Data Tables */
    .table, .table tbody, .table tr, .table td, .table th {
        display: block;
        width: 100%;
    }

    .table thead {
        display: none;
    }

    .table border-spacing {
        display: none;
    }

    .table td {
        text-align: right;
        padding: 12px 16px;
        position: relative;
        border: none !important;
        border-bottom: 1px solid rgba(148, 163, 184, 0.1) !important;
        border-radius: 0 !important;
        background: var(--surface) !important;
    }

    .table td::before {
        content: attr(data-label);
        position: absolute;
        left: 16px;
        font-weight: 700;
        color: #475569;
        font-size: 0.88rem;
    }

    .table tbody tr {
        margin-bottom: 16px;
        display: block;
        border: 1px solid rgba(148, 163, 184, 0.2);
        border-radius: 20px;
        overflow: hidden;
        box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
    }

    .table td:last-child {
        border-bottom: none !important;
    }

    .inline-actions {
        justify-content: flex-end;
    }
}

/* Custom Css */

.w-100 {
    width: 100%;
}

.h-100 {
    height: 100%;
}

.form-control {
    padding: 10px 14px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 10px;
    background: #fff;
    color: #0f172a;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.15s ease;
}

.form-control:focus {
    border-color: #4338ca;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 40px;
}

.pagination-wrap {
    margin-top: 24px;
    display: flex;
    justify-content: center;
    overflow-x: auto;
    padding: 0 8px;
}

.pagination-wrap nav {
    width: 100%;
}

.pagination-wrap .pagination {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center;
    gap: 8px !important;
    margin-bottom: 0;
    padding-left: 0;
    list-style: none;
}

.pagination-wrap .page-item {
    margin: 0 !important;
}

.pagination-wrap .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 14px;
    border-radius: 10px !important;
    border: 1px solid rgba(148, 163, 184, 0.35) !important;
    color: #334155 !important;
    background: #fff;
    box-shadow: none !important;
    white-space: nowrap;
}

.pagination-wrap .page-link:hover {
    background: #f8fafc !important;
    color: #0f172a !important;
}

.pagination-wrap .page-item.active .page-link {
    background: #4f46e5 !important;
    border-color: #4f46e5 !important;
    color: #fff !important;
}

.pagination-wrap .page-item.disabled .page-link {
    color: #94a3b8 !important;
    background: #fff !important;
}

@media (max-width: 576px) {
    .pagination-wrap {
        justify-content: flex-start;
    }

    .pagination-wrap .pagination {
        justify-content: flex-start !important;
        gap: 6px !important;
    }

    .pagination-wrap .page-link {
        min-width: 38px;
        height: 38px;
        padding: 0 10px;
        font-size: 0.875rem;
    }
}
