:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-main: #f4f7f9;
    --bg-sidebar: #ffffff;
    --card-bg: #ffffff;
    
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    
    /* Specific Colors from Mockup */
    --blue-dark: #1e40af;
    --orange-dark: #c2410c;
    --red-dark: #b91c1c;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', sans-serif; }

body { background-color: var(--bg-main); color: var(--text-main); line-height: 1.5; font-size: 14px; overflow: hidden; }

/* Utility Classes */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-blue { color: #3b82f6; }
.text-green { color: #10b981; }
.text-purple { color: #8b5cf6; }
.text-orange { color: #f59e0b; }
.text-red { color: #ef4444; }
.text-blue-dark { color: var(--blue-dark); font-weight: 600; }
.text-orange-dark { color: var(--orange-dark); font-weight: 600; }
.text-red-dark { color: var(--red-dark); font-weight: 600; }
.font-bold { font-weight: 700; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.85rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
.ml-2 { margin-left: 0.5rem; }
.ml-3 { margin-left: 0.75rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.border-none { border: none !important; }

/* Background Utilities for Icons */
.bg-blue-light { background-color: #eff6ff; }
.bg-green-light { background-color: #ecfdf5; }
.bg-purple-light { background-color: #f5f3ff; }
.bg-orange-light { background-color: #fffbeb; }

/* Layout */
.app-layout { display: grid; grid-template-columns: 260px 1fr; height: 100vh; width: 100vw; }

/* Sidebar */
.sidebar { background: var(--bg-sidebar); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; justify-content: space-between; }
.sidebar-logo-container { padding: 2rem; display: flex; justify-content: center; }
.sidebar-logo { height: 65px; width: auto; object-fit: contain; }
.nav-menu { display: flex; flex-direction: column; gap: 0.5rem; padding: 0 1rem; }
.nav-btn { display: flex; align-items: center; gap: 1rem; width: 100%; padding: 0.8rem 1rem; background: transparent; color: var(--text-muted); border: none; border-radius: 0.5rem; font-size: 0.95rem; font-weight: 600; text-align: left; cursor: pointer; transition: all 0.2s; }
.nav-btn i { font-size: 1.1rem; width: 20px; text-align: center; }
.nav-btn:hover { background: #f8fafc; color: var(--text-main); }
.nav-btn.active { background: #eff6ff; color: var(--primary); }
.sidebar-bottom { padding: 1.5rem; border-top: 1px solid var(--border-color); }
.user-profile { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; padding: 0.5rem; border: 1px solid var(--border-color); border-radius: 0.5rem; }
.avatar { width: 36px; height: 36px; background: var(--primary); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; }
.user-info { display: flex; flex-direction: column; }
.user-info strong { font-size: 0.9rem; color: var(--text-main); }
.user-info small { font-size: 0.75rem; color: var(--text-muted); }
.logout-btn { color: var(--text-main); }

/* Main Content */
.main-content { display: flex; flex-direction: column; height: 100vh; overflow: hidden; background: var(--bg-main); }
.top-header { display: flex; justify-content: space-between; align-items: center; padding: 1.5rem 2rem; background: var(--bg-main); z-index: 10; }
.top-header h1 { font-size: 1.5rem; font-weight: 700; color: #0f172a; }
.header-actions { display: flex; align-items: center; gap: 1rem; }

.content-body { flex: 1; overflow-y: auto; padding: 0 2rem 2rem 2rem; }
.view { display: none; animation: fadeIn 0.3s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Cards */
.card { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 0.75rem; padding: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.02); }
.card-header { margin-bottom: 1.25rem; border-bottom: 1px solid var(--border-color); padding-bottom: 1rem; }
.card-header h2 { font-size: 1.1rem; font-weight: 700; color: #1e293b; display: flex; align-items: center; }

/* Grid Layouts */
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

/* Summary Cards */
.summary-card { display: flex; align-items: flex-start; gap: 1rem; padding: 1.25rem; }
.summary-icon { width: 48px; height: 48px; border-radius: 0.5rem; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0; }
.summary-details { display: flex; flex-direction: column; flex: 1; }
.summary-title { font-size: 0.85rem; font-weight: 600; color: var(--text-main); margin-bottom: 0.25rem; }
.summary-value { font-size: 1.75rem; font-weight: 700; color: #0f172a; line-height: 1.2; }
.summary-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }
.summary-link { font-size: 0.8rem; color: var(--primary); text-decoration: none; margin-top: 0.5rem; font-weight: 500; display: flex; align-items: center; gap: 0.25rem; }
.summary-link:hover { text-decoration: underline; }

/* Master Upload List */
.master-upload-list { display: flex; flex-direction: column; gap: 1rem; }
.master-item { display: flex; align-items: center; gap: 1rem; padding: 1rem; border: 1px solid var(--border-color); border-radius: 0.5rem; background: #fafaf9; }
.master-icon { width: 40px; height: 40px; border-radius: 0.5rem; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.2rem; }
.master-info { flex: 1; }
.master-name { font-weight: 600; font-size: 0.95rem; color: var(--text-main); display: flex; align-items: center; }
.master-time { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem; }

/* Status Indicators */
.status-indicator { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.2rem; }
.status-text { font-size: 1.25rem; font-weight: 700; }
.status-text.ready { color: var(--success); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.red { background-color: var(--error); }
.dot.green { background-color: var(--success); }

/* Buttons & Inputs */
button { cursor: pointer; font-family: 'Inter', sans-serif; font-weight: 600; border-radius: 0.375rem; border: none; transition: all 0.2s; display: inline-flex; align-items: center; justify-content: center; }
.btn-primary { background-color: var(--primary); color: white; padding: 0.6rem 1.25rem; font-size: 0.9rem; }
.btn-primary:hover { background-color: var(--primary-hover); }
.btn-large { width: 100%; padding: 0.75rem; font-size: 1rem; }
.btn-outline { background: white; color: var(--text-main); padding: 0.5rem 1rem; border: 1px solid var(--border-color); font-size: 0.85rem; }
.btn-outline:hover { background: #f8fafc; }
.btn-outline-primary { background: white; color: var(--primary); padding: 0.4rem 0.8rem; border: 1px solid rgba(37,99,235,0.3); font-size: 0.85rem; }
.btn-outline-primary:hover { background: #eff6ff; border-color: var(--primary); }
.icon-btn { background: white; color: var(--text-main); width: 36px; height: 36px; border: 1px solid var(--border-color); border-radius: 50%; font-size: 1rem; }
.icon-btn:hover { background: #f8fafc; color: var(--primary); }
.btn-text { background: transparent; font-size: 0.85rem; font-weight: 600; padding: 0; }
.btn-text:hover { opacity: 0.8; }

.action-btn { width: 28px; height: 28px; border-radius: 0.25rem; border: 1px solid var(--border-color); background: white; color: var(--text-muted); display: inline-flex; align-items: center; justify-content: center; margin-right: 0.25rem; }
.action-btn:hover { border-color: var(--primary); color: var(--primary); }
.action-btn.delete-btn:hover { border-color: var(--error); color: var(--error); }

.form-select, .form-input { width: 100%; padding: 0.75rem; background: white; color: var(--text-main); border: 1px solid var(--border-color); border-radius: 0.375rem; outline: none; font-weight: 500; font-family: 'Inter', sans-serif; }
.form-select { appearance: none; background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%231e293b%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E'); background-repeat: no-repeat; background-position: right 1rem top 50%; background-size: 0.65rem auto; }
.form-select:focus, .form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,0.1); }

/* Search */
.search-container { position: relative; width: 350px; display: flex; align-items: center; }
.search-container.small-search { width: 250px; }
.search-icon { position: absolute; left: 1rem; color: var(--text-muted); font-size: 0.9rem; }
.search-input { width: 100%; padding: 0.6rem 1rem 0.6rem 2.5rem; background: white; color: var(--text-main); border: 1px solid var(--border-color); border-radius: 0.375rem; font-family: 'Inter', sans-serif; outline: none; font-size: 0.9rem; }
.search-input:focus { border-color: var(--primary); }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 0.15rem 0.6rem; border-radius: 1rem; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.badge-blue { background: #eff6ff; color: #1d4ed8; }
.badge-purple { background: #f5f3ff; color: #6d28d9; }
.badge-orange { background: #fff7ed; color: #c2410c; }
.badge-green { background: #ecfdf5; color: #047857; }
.badge-red { background: #fef2f2; color: #b91c1c; }

/* Table */
.table-card { padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.table-header { padding: 1.25rem 1.5rem; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); }
.table-header h2 { margin: 0; font-size: 1.1rem; }
.header-tools { display: flex; align-items: center; }
.table-wrapper { overflow: auto; width: 100%; }
.incoming-table-wrapper { max-height: calc(100vh - 280px); }

table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-color); font-size: 0.85rem; vertical-align: middle; }
th { background: #ffffff; font-weight: 700; color: #334155; position: sticky; top: 0; z-index: 10; border-bottom: 2px solid var(--border-color); }
tbody tr { background: #ffffff; }
tbody tr:hover { background: #f8fafc; }

/* Footer & Pagination */
.pagination-footer { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; border-top: 1px solid var(--border-color); background: #ffffff; }
.pagination-info { font-size: 0.85rem; color: var(--text-muted); }
.pagination-controls { display: flex; gap: 0.25rem; }
.page-btn { width: 32px; height: 32px; display: flex; justify-content: center; align-items: center; border: 1px solid var(--border-color); background: white; border-radius: 0.25rem; font-size: 0.85rem; font-weight: 500; color: var(--text-main); }
.page-btn:hover { background: #f8fafc; }
.page-btn.active { background: #eff6ff; color: var(--primary); border-color: var(--primary); }

.app-footer { text-align: center; padding-top: 2rem; color: var(--text-muted); font-size: 0.85rem; font-weight: 500; }

/* Modals */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15,23,42,0.5); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background: white; border-radius: 0.75rem; padding: 2rem; max-width: 500px; width: 90%; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); }
.modal-content h3 { color: var(--error); margin-bottom: 1rem; font-size: 1.25rem; }
.modal-actions { margin-top: 1.5rem; display: flex; gap: 1rem; justify-content: flex-end; }

.loading-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255,255,255,0.9); display: flex; flex-direction: column; justify-content: center; align-items: center; z-index: 2000; }
.spinner { width: 50px; height: 50px; border: 4px solid rgba(37,99,235,0.1); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Login */
.login-screen { position: fixed; top: 0; left: 0; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; background: var(--bg-main); z-index: 5000; }
.login-box { max-width: 400px; width: 90%; text-align: center; padding: 3rem 2rem; border: none; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03); }
.login-logo { height: 80px; width: auto; object-fit: contain; margin-bottom: 2rem; }
.login-box h2 { font-size: 1.5rem; color: var(--text-main); margin-bottom: 0.5rem; font-weight: 700; }
.login-box .btn-primary { width: 100%; margin-top: 1rem; padding: 0.75rem; font-size: 1rem; }
.login-error { color: var(--error); font-size: 0.85rem; margin-top: 1rem; }

.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 3rem 2rem;
    text-align: center;
    background-color: var(--bg-main);
    transition: all 0.3s ease;
    cursor: pointer;
}
.drop-zone:hover, .drop-zone.dragover {
    background-color: var(--blue-light);
    border-color: var(--blue);
}
.drop-icon {
    font-size: 3rem;
    color: var(--blue);
}
.batch-table { width: 100%; border-collapse: collapse; }
.batch-table th, .batch-table td { padding: 0.75rem; border-bottom: 1px solid var(--border-color); text-align: left; }
.batch-table th { background: var(--bg-main); font-weight: 600; color: var(--text-main); }


.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}
.toggle-switch .slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
.toggle-switch input:checked + .slider {
    background-color: var(--blue);
}
.toggle-switch input:checked + .slider:before {
    transform: translateX(26px);
}

