/* ============================================================
   AUTO-INFO — Professional theme
   ============================================================ */
:root {
    --primary:        #9E2424;
    --primary-dark:   #7A1B1B;
    --primary-light:  #C85C5C;

    --secondary:      #2563EB;
    --secondary-dark: #1D4ED8;
    --secondary-light:#60A5FA;

    --ink:            #1F2937;

    --bg-color:   #EEF1F7;
    --card-bg:    rgba(255, 255, 255, 0.72);
    --text-main:  #181A20;
    --text-muted: #6B7280;
    --success:    #10B981;
    --danger:     #EF4444;
    --glass-border: rgba(255, 255, 255, 0.55);
    --shadow:     0 8px 32px 0 rgba(0, 0, 0, 0.10);

    /* gradients */
    --grad-red:  linear-gradient(135deg, #B22B2B 0%, #7A1B1B 100%);
    --grad-blue: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Kanit', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f6fa 0%, #e6e9f2 100%);
}

#app-container {
    width: 100%;
    max-width: 480px;
    height: 100vh;
    background: linear-gradient(135deg, rgba(255,255,255,0.45), rgba(255,255,255,0.12));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 24px rgba(20, 21, 26, 0.08);
}

header {
    padding: 24px 20px 16px;
    background: linear-gradient(135deg, #9E2424 0%, #7A1B1B 55%, #5E1414 100%);
    z-index: 10;
    border-bottom: 3px solid var(--secondary);
    position: relative;
    overflow: hidden;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #ffffff;
    position: relative;
    z-index: 1;
    text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}

main {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 90px;
}

#view-container {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.tool-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 12px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
}

.tool-card:active {
    transform: scale(0.98);
}

.tool-img-container {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tool-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.tool-info h3 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 4px;
    line-height: 1.2;
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 8px;
    align-self: flex-start;
}

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

.status-borrowed {
    background: rgba(158, 36, 36, 0.12);
    color: var(--primary);
}

.status-future {
    background: rgba(37, 99, 235, 0.12);
    color: var(--secondary);
}

.status-maintenance {
    background: rgba(245, 158, 11, 0.12);
    color: #D97706;
}

.status-cancelled {
    background: rgba(107, 114, 128, 0.12);
    color: #6b7280;
}

/* === Page header row (action button + view toggle) === */
.page-header-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.page-header-row .view-toggle {
    margin-left: auto;
}

/* === View Toggle === */
.view-toggle {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.view-btn {
    background: none;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    color: var(--text-muted, #6b7280);
    font-size: 0.85rem;
}

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

/* === List View Rows === */
.tools-grid.list-mode {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--card-bg, #fff);
    border-radius: 12px;
    overflow: hidden;
    padding: 0 12px;
    border: 1px solid var(--border, #e5e7eb);
}

.list-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
    border-bottom: 1px solid var(--border, #e5e7eb);
    background: var(--card-bg, #fff);
}

.list-row:last-child {
    border-bottom: none;
}

.list-row.clickable {
    cursor: pointer;
    transition: background 0.15s;
}
.list-row.clickable:hover { background: rgba(0,0,0,0.025); }
.list-row.clickable:active { background: rgba(0,0,0,0.05); }

/* action buttons inside item-info-modal */
.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}
.modal-actions > .tool-action-btn,
.modal-actions > .btn-maint {
    width: 100%;
}
.modal-actions .btn-row {
    display: flex;
    gap: 8px;
}
.modal-actions .btn-row > * { flex: 1; }

.list-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.list-img {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.list-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.list-name {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-sub {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted, #6b7280);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* === Maintenance Button === */
.btn-maint {
    font-size: 0.72rem;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid #D97706;
    color: #D97706;
    background: none;
    cursor: pointer;
    white-space: nowrap;
    margin-top: 6px;
}

.btn-maint.active {
    background: #D97706;
    color: #fff;
}

/* === Queue Buttons === */
.btn-queue {
    background: rgba(37, 99, 235, 0.08);
    color: var(--secondary);
    border: 1px solid var(--secondary);
}

.btn-queue-cancel {
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.maintenance-msg {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted, #6b7280);
    font-style: italic;
    text-align: center;
    margin-top: 8px;
}
.maintenance-msg.list-action {
    display: inline-block;
    margin-top: 0;
    padding: 0 8px;
    flex-shrink: 0;
}

.queue-borrower-info {
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: var(--text-muted, #6b7280);
    background: rgba(0, 0, 0, 0.03);
    padding: 8px 12px;
    border-radius: 6px;
}

.queue-list {
    margin-bottom: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.6);
}
.queue-list-title {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--secondary);
}
.queue-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    padding: 4px 0;
    border-top: 1px dashed #f0f0f0;
}
.queue-list-item:first-of-type {
    border-top: none;
}
.queue-num {
    color: var(--text-muted, #6b7280);
    font-weight: 500;
    min-width: 18px;
}
.queue-name {
    font-weight: 500;
    flex: 1;
}
.queue-dates {
    font-size: 0.78rem;
    color: var(--text-muted, #6b7280);
}
.queue-list-empty, .queue-list-loading {
    font-size: 0.85rem;
    color: var(--text-muted, #6b7280);
    text-align: center;
    padding: 8px 0;
}

.queue-note {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
    font-size: 0.8rem;
    padding: 6px 10px;
    border-radius: 6px;
    margin: 8px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.queue-hint {
    color: #b45309;
    font-size: 0.78rem;
    margin-top: 4px;
}

.queue-cancelled-heading {
    grid-column: 1 / -1;
    font-size: 0.95rem;
    color: var(--text-muted, #6b7280);
    margin: 20px 0 4px;
    padding-top: 16px;
    border-top: 1px dashed var(--border, #e5e7eb);
}

.queue-cancelled-card {
    opacity: 0.85;
}

.queue-cancel-reason {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
    font-size: 0.78rem;
    padding: 6px 10px;
    border-radius: 6px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-returned {
    background: rgba(37, 99, 235, 0.12);
    color: var(--secondary);
}

.tool-details {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
    margin-bottom: 12px;
    background: rgba(255,255,255,0.6);
    padding: 8px;
    border-radius: 8px;
    flex: 1;
}

.tool-details p {
    margin-bottom: 4px;
    line-height: 1.3;
}
.tool-details p:last-child {
    margin-bottom: 0;
}

.tool-details strong {
    color: var(--text-main);
    font-weight: 500;
}

.tool-action-btn {
    margin-top: auto;
    padding: 8px;
    border-radius: 8px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    width: 100%;
}

.tool-action-btn:active {
    transform: scale(0.97);
}

.tool-action-btn.list-action {
    width: auto;
    margin-top: 0;
    padding: 6px 12px;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.btn-borrow {
    background: linear-gradient(135deg, #B22B2B, #7A1B1B);
    color: white;
    box-shadow: 0 3px 10px rgba(158, 36, 36, 0.28);
}

.btn-return {
    background: linear-gradient(135deg, #3B82F6, #1D4ED8);
    color: white;
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.28);
}

.btn-disabled {
    background: #E5E7EB;
    color: #9CA3AF;
    cursor: not-allowed;
    box-shadow: none;
}

/* Card Actions (Edit/Delete) */
.action-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.action-icon:hover {
    transform: scale(1.1);
}
.action-icon.edit:hover { color: var(--secondary); background: #fff; }
.action-icon.delete:hover { color: var(--danger); background: #fff; }
.action-icon.info { width: 28px; height: 28px; background: rgba(0,0,0,0.04); box-shadow: none; flex-shrink: 0; }
.action-icon.info:hover { color: var(--secondary); background: #fff; }

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.1);
    background: rgba(255,255,255,0.8);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group select {
    appearance: none;
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #B22B2B 0%, #7A1B1B 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(158, 36, 36, 0.32);
    transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
}

.btn-primary:hover {
    filter: brightness(1.05);
}

.btn-primary:active {
    transform: translateY(2px);
    background: linear-gradient(135deg, #7A1B1B 0%, #5E1414 100%);
    box-shadow: 0 3px 8px rgba(158, 36, 36, 0.3);
}

/* Bottom Navigation */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-top: 2px solid var(--secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    background: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.65rem;
    cursor: pointer;
    transition: color 0.2s;
    width: 20%;
}

.nav-item i {
    font-size: 1.2rem;
    margin-bottom: 4px;
    transition: transform 0.2s;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item.active i {
    transform: scale(1.15);
    filter: drop-shadow(0 2px 4px rgba(158, 36, 36, 0.4));
}

/* Modal */
.modal {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(20, 21, 26, 0.5);
    backdrop-filter: blur(4px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 400px;
    border-radius: 20px;
    padding: 24px;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s;
    box-shadow: 0 10px 40px rgba(20, 21, 26, 0.3);
    border-top: 4px solid var(--primary);
    max-height: 90vh;
    overflow-y: auto;
}

.modal.show .modal-content {
    transform: translateY(0);
}

.close-btn {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.modal h2 {
    margin-bottom: 16px;
    font-size: 1.25rem;
    padding-right: 24px;
    color: var(--ink);
}

.modal-img {
    width: 100%;
    height: 120px;
    object-fit: contain;
    background: #f9fafb;
    border-radius: 12px;
    margin-bottom: 16px;
}

/* Scrollbar styling for modal */
.modal-content::-webkit-scrollbar {
    width: 6px;
}
.modal-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* Employee Cards - AUTO-INFO Theme */
.emp-card {
    background: linear-gradient(145deg, #ffffff, #fdfdfd);
    border: none;
    border-radius: 16px;
    padding: 24px 16px;
    box-shadow: 0 10px 20px -5px rgba(158, 36, 36, 0.15), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border-top: 5px solid var(--primary);
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.emp-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 25px -5px rgba(158, 36, 36, 0.22), 0 8px 10px -2px rgba(0, 0, 0, 0.1);
}
.emp-img-container {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 16px;
    border: 4px solid #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background: #f3f4f6;
}
.emp-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.emp-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}
.badge-stats {
    font-size: 0.75rem;
    color: var(--primary);
    background: rgba(158, 36, 36, 0.08);
    border-radius: 20px;
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-weight: 500;
}

/* Reservations */
.btn-reserve {
    background: #F59E0B;
    color: white;
}

.reservation-list {
    margin-top: 8px;
    margin-bottom: 12px;
    font-size: 0.75rem;
    color: #4B5563;
    background: rgba(245, 158, 11, 0.1);
    padding: 6px 8px;
    border-radius: 6px;
    border-left: 3px solid #F59E0B;
}

.reservation-list strong {
    color: #B45309;
    display: block;
    margin-bottom: 4px;
}

.reservation-list ul {
    list-style: none;
    padding-left: 0;
}

.reservation-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    border-bottom: 1px dashed rgba(245, 158, 11, 0.2);
    padding-bottom: 4px;
}

.reservation-list li:last-child {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.res-cancel {
    color: var(--danger);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 2px;
    transition: transform 0.2s;
}
.res-cancel:hover {
    transform: scale(1.2);
}

/* ==================== ADMIN-ONLY ==================== */
body:not([data-role="admin"]) .admin-only { display: none !important; }

/* ==================== LOGIN SCREEN ==================== */
#login-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #9E2424 0%, #7A1B1B 50%, #5E1414 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    overflow: hidden;
}

.login-box {
    background: white;
    border-radius: 24px;
    padding: 36px 28px;
    width: 90%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(20, 21, 26, 0.45);
    position: relative;
    z-index: 1;
    border-top: 4px solid var(--secondary);
}
.login-logo {
    width: 64px; height: 64px;
    background: linear-gradient(135deg, #B22B2B 0%, #7A1B1B 100%);
    border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
    font-size: 1.8rem; color: white;
    box-shadow: 0 8px 20px rgba(158, 36, 36, 0.35);
}
.login-title {
    text-align: center;
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 4px;
    letter-spacing: 0.02em;
}
.login-subtitle {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}
.login-error {
    color: var(--danger);
    font-size: 0.85rem;
    margin-bottom: 12px;
    min-height: 20px;
}
.remember-row { margin: -4px 0 12px; }
.remember-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.remember-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}
.password-wrapper {
    position: relative;
}
.password-wrapper input { padding-right: 44px; }
.toggle-password {
    position: absolute;
    right: 12px; top: 50%;
    transform: translateY(-50%);
    background: none; border: none;
    color: var(--text-muted); cursor: pointer;
    font-size: 0.9rem;
}

/* ==================== UPLOAD AREA ==================== */
.upload-area {
    border: 2px dashed rgba(37, 99, 235, 0.32);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: rgba(37, 99, 235, 0.03);
}
.upload-area:hover { border-color: var(--secondary); background: rgba(37, 99, 235, 0.06); }
.upload-placeholder {
    display: flex; flex-direction: column;
    align-items: center; gap: 8px;
    color: var(--text-muted); font-size: 0.9rem;
}
.upload-placeholder i { font-size: 2rem; color: var(--secondary-light); }

/* ==================== CURRENT USER DISPLAY ==================== */
.current-user-display {
    background: rgba(37, 99, 235, 0.07);
    border: 1px solid rgba(37, 99, 235, 0.22);
    border-radius: 12px;
    padding: 12px 16px;
    font-weight: 500;
    color: var(--secondary-dark);
}

/* ==================== PROFILE VIEW ==================== */
.profile-card {
    background: white;
    border-radius: 20px;
    padding: 24px;
    text-align: center;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    border-top: 4px solid var(--primary);
}
.profile-avatar-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 12px;
}
.profile-avatar {
    width: 90px; height: 90px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    display: block;
}
.profile-avatar-edit {
    position: absolute;
    bottom: 0; right: 0;
    width: 28px; height: 28px;
    background: var(--secondary);
    border: none; border-radius: 50%;
    color: white; cursor: pointer;
    font-size: 0.7rem;
    display: flex; align-items: center; justify-content: center;
}
.profile-info h2 { font-size: 1.2rem; font-weight: 600; }
.role-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 4px;
}
.role-badge.admin { background: rgba(158, 36, 36, 0.1); color: var(--primary); }
.role-badge.user  { background: rgba(37, 99, 235, 0.1); color: var(--secondary); }

.profile-section {
    background: white;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}
.profile-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}
.profile-menu-list { display: flex; flex-direction: column; gap: 4px; }
.profile-menu-item {
    display: flex; align-items: center; gap: 12px;
    background: none; border: none;
    padding: 12px 8px;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    font-size: 0.95rem;
    color: var(--text-main);
    transition: background 0.2s;
    width: 100%;
}
.profile-menu-item:hover { background: rgba(37, 99, 235, 0.06); }
.profile-menu-item i:first-child { color: var(--primary); width: 20px; text-align: center; }
.profile-menu-item span { flex: 1; }
.profile-menu-item i:last-child { color: var(--text-muted); font-size: 0.8rem; }

/* Employee row list in profile */
.employee-row-list { display: flex; flex-direction: column; gap: 8px; }
.employee-row {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 4px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.employee-row:last-child { border-bottom: none; }
.employee-row img {
    width: 40px; height: 40px;
    border-radius: 50%; object-fit: cover;
    border: 2px solid var(--primary);
    flex-shrink: 0;
}
.employee-row-name { flex: 1; font-size: 0.95rem; font-weight: 500; }
.employee-row-count {
    font-size: 0.75rem; color: var(--primary);
    background: rgba(158, 36, 36, 0.08);
    padding: 3px 10px; border-radius: 20px;
}

.btn-logout {
    width: 100%; padding: 14px;
    background: rgba(239,68,68,0.08);
    color: var(--danger);
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: 12px;
    font-size: 1rem; font-weight: 500;
    cursor: pointer; margin-top: 4px;
    transition: background 0.2s;
}
.btn-logout:hover { background: rgba(239,68,68,0.15); }

/* ==================== SUBPAGE ==================== */
.subpage {
    display: none;
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--bg-color);
    z-index: 50;
    overflow-y: auto;
    padding-bottom: 90px;
    animation: slideIn 0.25s ease;
}
.subpage.active { display: block; }
@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}
.subpage-header {
    display: flex; align-items: center; gap: 12px;
    padding: 20px;
    background: rgba(255,255,255,0.9);
    position: sticky; top: 0; z-index: 10;
    border-bottom: 1px solid var(--glass-border);
}
.subpage-header h2 { flex: 1; font-size: 1.1rem; }
.btn-back {
    background: none; border: none;
    color: var(--primary); cursor: pointer;
    font-size: 1.1rem; padding: 4px;
}
.btn-sm {
    width: auto; padding: 8px 16px;
    font-size: 0.85rem; border-radius: 8px;
}

.manage-items-tabs {
    display: flex; gap: 8px;
    padding: 12px 20px 0;
}
.tab-btn {
    flex: 1; padding: 10px;
    border: 1px solid rgba(37, 99, 235, 0.2);
    background: white; border-radius: 10px;
    color: var(--text-muted); cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.tab-btn.active {
    background: var(--primary); color: white;
    border-color: var(--primary);
}

/* ==================== HISTORY TABLE ==================== */
.history-controls { margin-bottom: 12px; }
.search-bar {
    display: flex; align-items: center; gap: 10px;
    background: white; border-radius: 12px;
    padding: 10px 16px;
    border: 1px solid rgba(0,0,0,0.08);
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.search-bar i { color: var(--text-muted); }
.search-bar input {
    border: none; background: none;
    flex: 1; font-size: 0.95rem;
    outline: none; padding: 0;
}
.filter-bar {
    display: flex; gap: 8px; flex-wrap: wrap;
}
.filter-bar select {
    flex: 1; min-width: 120px;
    padding: 8px 12px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 10px; font-size: 0.85rem;
    background: white; cursor: pointer;
}
.btn-clear-filter {
    padding: 8px 12px;
    border: 1px solid rgba(239,68,68,0.3);
    background: rgba(239,68,68,0.05);
    color: var(--danger); border-radius: 10px;
    cursor: pointer; font-size: 0.85rem;
    white-space: nowrap;
    transition: background 0.2s;
}
.btn-clear-filter:hover { background: rgba(239,68,68,0.1); }
.filter-custom-date {
    display: flex; align-items: center; gap: 8px;
    margin-top: 8px; flex-wrap: wrap;
}
.filter-custom-date input {
    flex: 1; padding: 8px 12px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 10px; font-size: 0.85rem;
}
.filter-custom-date span { color: var(--text-muted); font-size: 0.85rem; }

.history-table-wrapper {
    background: white; border-radius: 16px;
    box-shadow: var(--shadow);
    overflow-x: auto;
    margin-bottom: 12px;
}
.history-table {
    width: 100%; border-collapse: collapse;
    font-size: 0.82rem; min-width: 560px;
}
.history-table thead {
    background: rgba(37, 99, 235, 0.06);
    position: sticky; top: 0;
}
.history-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    white-space: nowrap;
}
.history-table th.sortable { cursor: pointer; user-select: none; }
.history-table th.sortable:hover { color: var(--secondary); }
.history-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    color: var(--text-main);
    vertical-align: middle;
}
.history-table tr:last-child td { border-bottom: none; }
.history-table tr:hover td { background: rgba(37, 99, 235, 0.04); }
.history-table td img {
    width: 36px; height: 36px;
    border-radius: 8px; object-fit: cover;
}
.history-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}
.history-empty i { font-size: 2rem; margin-bottom: 8px; display: block; }

/* ==================== PAGINATION ==================== */
.pagination-bar {
    display: flex; align-items: center;
    justify-content: space-between;
    flex-wrap: wrap; gap: 8px;
    margin-top: 8px;
}
.pagination-info {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.82rem; color: var(--text-muted);
}
.pagination-info select {
    padding: 4px 8px; border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.1);
    font-size: 0.82rem; background: white;
}
.pagination-buttons {
    display: flex; gap: 4px; flex-wrap: wrap;
}
.page-btn {
    min-width: 32px; height: 32px;
    border: 1px solid rgba(0,0,0,0.1);
    background: white; border-radius: 8px;
    cursor: pointer; font-size: 0.82rem;
    color: var(--text-main);
    transition: all 0.2s;
    padding: 0 8px;
}
.page-btn:hover { border-color: var(--secondary); color: var(--secondary); }
.page-btn.active {
    background: var(--primary); color: white;
    border-color: var(--primary);
}
.page-btn:disabled {
    opacity: 0.4; cursor: not-allowed;
}
