:root {
    --navy: #0b1f3a;
    --blue: #1e5fa8;
    --gold: #c8921a;
    --gold-light: #f0b429;
    --primary: var(--navy);
    --primary-dark: #050d18;
    --secondary: var(--gold);
    --accent: var(--gold-light);
    --success: var(--blue);
    --warning: #f59e0b;
    --danger: #ef4444;
    --white: #ffffff;

    --bg-primary: #ffffff;
    --bg-secondary: #f4f7fa;
    --bg-tertiary: #edf2f7;
    --text-primary: #0b1f3a;
    --text-secondary: #4a5568;
    --text-tertiary: #a0aec0;
    --border: rgba(11, 31, 58, 0.08);

    --shadow-sm: 0 2px 4px rgba(11, 31, 58, 0.04);
    --shadow-md: 0 10px 20px rgba(11, 31, 58, 0.06);
    --shadow-lg: 0 20px 40px rgba(11, 31, 58, 0.08);
    --shadow-xl: 0 30px 60px rgba(11, 31, 58, 0.12);

    --font-display: 'Poppins', sans-serif;
    --font-body: 'Inter', sans-serif;

    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    --radius-sm: 0.375rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-2xl: 2.5rem;

    --transition: all 0.3s ease;

    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(11, 31, 58, 0.06);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

.logo-dot {
    color: var(--gold-light);
}

/* LOADER */
.loader-wrapper {
    position: fixed;
    inset: 0;
    background: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader-wrapper.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(34, 197, 94, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.page-content-fade {
    opacity: 0;
    transition: opacity 0.8s ease;
}

.page-content-fade.visible {
    opacity: 1;
}

/* LAYOUT */
.dashboard-container {
    display: flex;
    min-height: 100vh;
    background: var(--bg-secondary);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    z-index: 90;
}

.sidebar {
    width: 260px;
    background: #1a1f2c;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 200;
    transition: var(--transition);
    box-shadow: 10px 0 30px rgba(11, 31, 58, 0.05);
}

.sidebar.collapsed {
    transform: translateX(-260px);
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 70px;
}

.sidebar-header .logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-menu {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.sidebar-menu-label {
    padding: 0.75rem 1.5rem 0.4rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.35);
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-menu-inner {
    list-style: none;
    padding: 0;
    margin: 0 0 0.5rem 0;
}

.sidebar-item {
    position: relative;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 1.5rem;
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    transition: var(--transition);
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.07);
    border-left-color: rgba(255, 255, 255, 0.3);
}

.sidebar-link.active {
    color: #fff;
    background: rgba(200, 146, 26, 0.15);
    border-left: 4px solid var(--gold);
}

.sidebar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
}

.sidebar-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: #aeaeb7;
}

.sidebar svg,
.sidebar i {
    color: #aeaeb7;
}

.sidebar-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 50px;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.15);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.sidebar-user-avatar,
.topbar-user-avatar-s,
.profile-menu-avatar-s,
.profile-view-avatar,
#profileEditAvatarContainer {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-user-info {
    overflow: hidden;
}

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

.sidebar-user-email {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.45);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.theme-toggle-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.theme-icon {
    color: rgba(255, 255, 255, 0.6);
    flex-shrink: 0;
}

.theme-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.55);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    font-weight: 500;
    transition: var(--transition);
}

.theme-switch {
    position: relative;
    display: inline-block;
    cursor: pointer;
    flex-shrink: 0;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.theme-switch-track {
    display: block;
    width: 42px;
    height: 22px;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 11px;
    transition: background 0.3s;
    position: relative;
}

.theme-switch input:checked+.theme-switch-track {
    background: var(--primary);
}

.theme-switch-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-switch input:checked+.theme-switch-track .theme-switch-thumb {
    transform: translateX(20px);
}

.sun-icon {
    color: #f59e0b;
    display: block;
}

.moon-icon {
    color: #6366f1;
    display: none;
}

.theme-switch input:checked+.theme-switch-track .theme-switch-thumb .sun-icon {
    display: none;
}

.theme-switch input:checked+.theme-switch-track .theme-switch-thumb .moon-icon {
    display: block;
}

/* MAIN */
.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.sidebar.collapsed~.main-content {
    margin-left: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    padding: 0 1.5rem;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.topbar-toggle:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.breadcrumb-home {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

.breadcrumb-sep {
    color: var(--text-tertiary);
}

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

.topbar-center {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.topbar-brand img {
    border-radius: 4px;
    object-fit: contain;
}

.topbar-brand-name {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.02em;
}

.topbar-mobile-title {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-tertiary);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-divider {
    width: 1px;
    height: 28px;
    background: var(--border);
}

.topbar-user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.topbar-user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.topbar-user-role {
    font-size: 0.72rem;
    color: var(--text-tertiary);
}

.main-content-inner {
    flex: 1;
    padding: 1.75rem;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-xl);
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.page-title {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
    color: var(--text-primary);
}

.page-subtitle {
    color: var(--text-secondary);
}

.view-container {
    display: none;
}

.view-container.active {
    display: block;
    animation: fadeIn 0.35s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* PROFILE MENU */
.profile-dropdown {
    position: relative;
}

.profile-trigger {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem 0.65rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
    font-family: var(--font-body);
}

.profile-trigger:hover {
    background: var(--bg-secondary);
}

.profile-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 230px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    z-index: 999;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.profile-dropdown.open .profile-menu {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.profile-menu-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-secondary);
}

.profile-menu-name {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.profile-menu-email {
    font-size: 0.72rem;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 145px;
}

.profile-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 0.25rem 0;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.7rem 1rem;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: var(--transition);
}

.profile-menu-item:hover {
    background: var(--bg-secondary);
    color: var(--primary);
}

.profile-menu-item.danger {
    color: var(--danger);
}

.profile-menu-item.danger:hover {
    background: rgba(239, 68, 68, 0.07);
    color: var(--danger);
}

/* COMMON */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.15rem;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

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

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

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

.btn-secondary:hover {
    background: var(--bg-secondary);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    margin-bottom: 1rem;
}

.form-group label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: var(--transition);
    background: white;
    color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(11, 31, 58, 0.08);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.form-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: flex-end;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.search-group {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-group input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    background: white;
    color: var(--text-primary);
}

.search-group svg {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    flex-wrap: wrap;
}

.filter-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.filter-group select,
.date-input,
.filter-select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: white;
    font-family: var(--font-body);
    color: var(--text-primary);
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.badge-status {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.empty-state {
    text-align: center;
    padding: var(--spacing-2xl);
    color: var(--text-secondary);
}

/* BROWSE */
.equipment-filters,
.logs-filters {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
    align-items: flex-end;
}

.equipment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    gap: var(--spacing-lg);
}

.equipment-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    transition: var(--transition);
    cursor: pointer;
}

.equipment-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.equipment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-md);
    gap: 1rem;
}

.equipment-id {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--primary);
    font-size: 0.875rem;
}

.equipment-status {
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 500;
}

.equipment-status.available {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.equipment-status.borrowed,
.equipment-status.pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.equipment-status.maintenance {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.equipment-name {
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

.equipment-category {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.equipment-actions {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
    margin-top: 1rem;
}

/* SCAN */
.qr-scanner-container {
    max-width: 800px;
    margin: 0 auto;
}

.scanner-box {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--spacing-xl);
}

#qr-reader {
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
}

.scanner-instructions {
    margin-top: var(--spacing-lg);
    padding: var(--spacing-lg);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.scanner-instructions h3 {
    font-family: var(--font-display);
    margin-bottom: var(--spacing-md);
}

.scanner-instructions ol {
    margin-left: var(--spacing-lg);
}

.scanner-instructions li {
    margin-bottom: var(--spacing-sm);
    color: var(--text-secondary);
}

.manual-entry {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-sm);
}

.manual-entry h3 {
    font-family: var(--font-display);
    margin-bottom: var(--spacing-md);
}

.manual-form {
    display: flex;
    gap: var(--spacing-md);
}

.manual-form input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    background: white;
    color: var(--text-primary);
}

/* BORROWED */
.borrowed-items-grid {
    display: grid;
    gap: var(--spacing-md);
}

.borrowed-item-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--warning);
}

.borrowed-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-md);
    gap: 1rem;
}

.borrowed-item-info {
    flex: 1;
}

.borrowed-item-name {
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

.borrowed-item-id {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.borrowed-item-meta {
    display: flex;
    gap: var(--spacing-md);
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    flex-wrap: wrap;
}

.due-date {
    font-weight: 500;
}

.due-date.overdue {
    color: var(--danger);
}

.borrowed-item-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* HISTORY */
.logs-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.log-item {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
}

.log-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
    gap: 1rem;
    flex-wrap: wrap;
}

.log-item-title {
    font-weight: 600;
}

.log-item-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
    gap: var(--spacing-md);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.log-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.log-label {
    font-weight: 500;
    color: var(--text-tertiary);
}

.log-value {
    color: var(--text-primary);
}

.history-status {
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 500;
}

.history-status.returned {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.history-status.borrowed {
    background: rgba(6, 182, 212, 0.1);
    color: var(--primary);
}

.history-status.pending_borrow {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.history-status.pending_return {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.history-status.pending_extension {
    background: rgba(30, 64, 175, 0.1);
    color: #1e40af;
}

.history-status.rejected {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* SETTINGS */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.settings-card {
    background: #fff;
    padding: 22px;
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border);
}

.settings-card h3 {
    margin-bottom: 6px;
    font-family: var(--font-display);
}

.settings-card p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

/* MODALS */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
}

.modal-content.large {
    max-width: 700px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-xl);
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-family: var(--font-display);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--border);
}

.modal-content .login-form,
.modal-content .borrow-detail,
.modal-content #borrowDetail,
.modal-content #returnDetail,
.modal-content #extendDetail {
    padding: var(--spacing-xl);
}

.modal-footer {
    padding: var(--spacing-xl);
    border-top: 1px solid var(--border);
    display: flex;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.feedback-detail {
    padding: var(--spacing-xl);
}

.detail-row {
    margin-bottom: var(--spacing-lg);
}

.detail-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.detail-value {
    font-size: 1rem;
    color: var(--text-primary);
}

/* TOAST */
.toast {
    position: fixed;
    bottom: -100px;
    right: var(--spacing-xl);
    background: var(--text-primary);
    color: white;
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    z-index: 10000;
    transition: var(--transition);
    max-width: 400px;
}

.toast.show {
    bottom: var(--spacing-xl);
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

/* DARK MODE */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #263249;
    --text-primary: #ffffff;
    --text-secondary: #f1f5f9;
    --text-tertiary: #cbd5e1;
    --border: #334155;
    color: #ffffff;
}

[data-theme="dark"] .topbar {
    background: #1e293b;
    border-bottom-color: #334155;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .equipment-card,
[data-theme="dark"] .borrowed-item-card,
[data-theme="dark"] .log-item,
[data-theme="dark"] .scanner-box,
[data-theme="dark"] .manual-entry,
[data-theme="dark"] .settings-card,
[data-theme="dark"] .modal-content {
    background: #243043;
    border-color: #334155;
}

[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .form-group textarea,
[data-theme="dark"] .filter-group select,
[data-theme="dark"] .date-input,
[data-theme="dark"] .filter-select,
[data-theme="dark"] .manual-form input,
[data-theme="dark"] .search-group input {
    background: #263249;
    border-color: #334155;
    color: #ffffff;
}

[data-theme="dark"] .profile-menu {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .profile-menu-header {
    background: #263249;
}

[data-theme="dark"] .profile-menu-item:hover,
[data-theme="dark"] .topbar-toggle:hover,
[data-theme="dark"] .profile-trigger:hover {
    background: #263249;
}

[data-theme="dark"] .btn-secondary {
    background: #263249;
    color: #f1f5f9;
    border-color: #334155;
}

[data-theme="dark"] .scanner-instructions {
    background: #263249;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }

    .main-content {
        margin-left: 240px;
    }
}

@media (max-width: 768px) {
    .sidebar-overlay.active {
        display: block;
    }

    .sidebar {
        transform: translateX(-110%);
        transition: transform 0.28s ease;
        z-index: 1000;
        box-shadow: var(--shadow-xl);
        width: min(86vw, 320px);
    }

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

    .main-content {
        margin-left: 0;
        padding-top: 70px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        transform: translateX(-100%);
        width: min(260px, 82vw) !important;
        overflow-x: hidden;
    }

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

    .main-content {
        margin-left: 0 !important;
        padding-top: 0;
    }

    .topbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 60px;
        padding: 0 0.75rem;
        gap: 0.5rem;
        z-index: 190;
    }

    .topbar-user-info,
    .topbar-breadcrumb {
        display: none;
    }

    .topbar-center {
        display: flex;
    }

    .main-content-inner {
        padding: calc(60px + 0.85rem) 0.85rem 1rem;
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .page-title {
        font-size: 1.35rem;
    }

    .page-subtitle {
        font-size: 0.82rem;
    }

    .btn {
        width: 100%;
        min-height: 42px;
        border-radius: 10px;
        font-size: 0.9rem;
    }

    .equipment-filters,
    .logs-filters,
    .form-actions,
    .modal-footer,
    .manual-form {
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
    }

    .filter-group input,
    .filter-group select,
    .date-input {
        width: 100%;
    }

    .equipment-grid,
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .equipment-card,
    .borrowed-item-card,
    .log-item {
        border-radius: 14px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
    }

    .borrowed-item-header,
    .log-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }

    .log-item-info,
    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: calc(100vw - 2rem);
        margin: 1rem;
    }
}

@media (max-width: 400px) {
    .topbar {
        height: 56px;
        padding: 0 0.5rem;
    }

    .sidebar {
        width: min(220px, 78vw) !important;
    }

    .sidebar-header {
        padding: 0.85rem 1rem;
        min-height: 56px;
    }

    .sidebar-header .logo {
        font-size: 1rem;
    }

    .sidebar-link {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .sidebar-menu-label {
        padding: 0.6rem 1rem 0.3rem;
        font-size: 0.65rem;
    }

    .sidebar-footer {
        padding: 0.75rem 1rem;
    }

    .sidebar-user-info,
    .theme-label {
        display: none;
    }

    .theme-toggle-row {
        justify-content: center;
    }

    .main-content-inner {
        padding: calc(56px + 0.75rem) 0.6rem 0.75rem;
    }

    .page-title {
        font-size: 1.1rem !important;
        color: var(--text-primary) !important;
    }

    .page-subtitle {
        font-size: 0.78rem;
    }

    .equipment-card,
    .borrowed-item-card,
    .log-item,
    .settings-card {
        padding: 0.85rem;
    }

    .modal-content {
        width: calc(100vw - 1.5rem);
        margin: 0.5rem;
        max-height: 90vh;
        overflow-y: auto;
    }

    .toast {
        right: 0.75rem;
        left: 0.75rem;
        max-width: unset;
    }
}