:root {
    --admin-sidebar-width: 260px;
    --admin-topbar-height: 64px;
    --admin-bg: #f4f6f9;
    --admin-sidebar-bg: #1a1d24;
    --admin-sidebar-hover: rgba(255, 255, 255, 0.08);
    --admin-sidebar-active: #0d6efd;
    --admin-card-radius: 0.75rem;
    --admin-font: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
}

body.admin-body {
    margin: 0;
    font-family: var(--admin-font);
    background: var(--admin-bg);
    color: #212529;
    min-height: 100vh;
}

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

/* Sidebar */
.admin-sidebar {
    width: var(--admin-sidebar-width);
    min-width: var(--admin-sidebar-width);
    background: var(--admin-sidebar-bg);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1040;
    transition: transform 0.25s ease;
}

.admin-sidebar-brand {
    padding: 1.25rem 1rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-sidebar-brand h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.admin-sidebar-brand small {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.7rem;
}

.admin-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0.5rem 1rem;
}

.admin-sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

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

.admin-nav-section {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.4);
    padding: 0.75rem 0.75rem 0.35rem;
    margin-top: 0.25rem;
}

.admin-sidebar .nav-link {
    color: rgba(255, 255, 255, 0.85);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 2px;
    transition: background 0.15s, color 0.15s;
}

.admin-sidebar .nav-link:hover {
    color: #fff;
    background: var(--admin-sidebar-hover);
}

.admin-sidebar .nav-link.active {
    color: #fff;
    background: var(--admin-sidebar-active);
    font-weight: 500;
}

.admin-sidebar .nav-link i {
    font-size: 1.05rem;
    width: 1.25rem;
    text-align: center;
    opacity: 0.9;
}

.admin-sidebar-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.45);
}

/* Main area */
.admin-main {
    flex: 1;
    margin-left: var(--admin-sidebar-width);
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

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

.admin-page-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-topbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.admin-topbar-user .user-name {
    font-size: 0.875rem;
    color: #495057;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

/* Toolbar */
.page-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.page-toolbar-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex: 1;
    min-width: 200px;
}

.page-toolbar-filters .form-control,
.page-toolbar-filters .form-select {
    min-width: 140px;
    max-width: 220px;
}

.page-toolbar-actions {
    flex-shrink: 0;
}

/* Cards & tables */
.admin-content .card {
    border: none;
    border-radius: var(--admin-card-radius);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.admin-content .card-header {
    background: #fff;
    border-bottom: 1px solid #eef0f2;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.85rem 1.25rem;
}

.admin-content .admin-table-card .card-body {
    padding: 0;
}

.admin-content .admin-table-card .table {
    margin-bottom: 0;
}

.admin-content .admin-table-card .table thead th {
    background: #f8f9fb;
    border-bottom: 1px solid #eef0f2;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.admin-content .admin-table-card .table tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    font-size: 0.9rem;
}

.admin-content .admin-table-card .card-footer {
    background: #fff;
    border-top: 1px solid #eef0f2;
    padding: 0.75rem 1rem;
}

/* Action buttons */
.btn-actions {
    display: inline-flex;
    gap: 0.25rem;
    flex-wrap: nowrap;
}

.btn-actions .btn {
    padding: 0.25rem 0.45rem;
    line-height: 1.2;
}

/* Stat cards */
.stat-card {
    border: none;
    border-radius: var(--admin-card-radius);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    height: 100%;
    transition: transform 0.15s, box-shadow 0.15s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

/* Alerts */
.admin-alert {
    border: none;
    border-radius: 0.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

/* Forms */
.admin-form-card .card-body {
    padding: 1.5rem;
}

.form-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.35rem;
}

/* Pagination */
.pagination {
    margin-bottom: 0;
}

/* Sidebar backdrop (mobile) */
.admin-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1035;
}

.admin-sidebar-backdrop.show {
    display: block;
}

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

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

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

    .admin-topbar-user .user-name {
        display: none;
    }

    .page-toolbar-filters .form-control,
    .page-toolbar-filters .form-select {
        max-width: 100%;
        flex: 1 1 100%;
    }
}

/* Auth */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1d24 0%, #2d3748 50%, #1a1d24 100%);
    padding: 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    border: none;
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.auth-brand {
    text-align: center;
    padding: 2rem 2rem 0;
}

.auth-brand h1 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

/* Tracking */
.tracking-page {
    min-height: 100vh;
    background: linear-gradient(180deg, #f4f6f9 0%, #e9ecef 100%);
}

.tracking-timeline .timeline-item {
    position: relative;
    padding-left: 1.5rem;
    padding-bottom: 1rem;
    border-left: 2px solid #dee2e6;
    margin-left: 0.5rem;
}

.tracking-timeline .timeline-item:last-child {
    border-left-color: transparent;
    padding-bottom: 0;
}

.tracking-timeline .timeline-item::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #dee2e6;
}

.tracking-timeline .timeline-item.active::before {
    background: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}
