/* Expense Management System - ERPNext Style Black & White Theme */

:root {
    --white: #ffffff;
    --black: #000000;
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #eeeeee;
    --gray-300: #e0e0e0;
    --gray-400: #bdbdbd;
    --gray-500: #9e9e9e;
    --gray-600: #757575;
    --gray-700: #616161;
    --gray-800: #424242;
    --gray-900: #212121;
    --success: #2e7d32;
    --warning: #f57c00;
    --danger: #c62828;
    --info: #1565c0;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 13px;
    line-height: 1.5;
    color: var(--gray-900);
    background-color: var(--gray-100);
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 220px;
    background: var(--white);
    border-right: 1px solid var(--gray-300);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-300);
    background: var(--white);
}

.sidebar-header h1 {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-900);
}

.sidebar-nav {
    padding: 12px 0;
}

.nav-section {
    margin-bottom: 8px;
}

.nav-section-title {
    padding: 8px 20px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: var(--gray-700);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.nav-link.active {
    background: var(--gray-100);
    color: var(--black);
    border-left-color: var(--black);
    font-weight: 500;
}

.nav-link svg {
    width: 16px;
    height: 16px;
    margin-right: 10px;
    stroke: currentColor;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 220px;
    min-height: 100vh;
}

/* Header */
.page-header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-300);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.page-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-900);
}

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

/* Breadcrumb */
.breadcrumb {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 2px;
}

.breadcrumb a {
    color: var(--gray-600);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* Content Area */
.content-area {
    padding: 24px;
}

/* Cards */
.card {
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    margin-bottom: 16px;
}

.card-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--gray-50);
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-800);
}

.card-body {
    padding: 16px;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

tr:hover {
    background: var(--gray-50);
}

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

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-label.required::after {
    content: ' *';
    color: var(--danger);
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    background: var(--white);
    color: var(--gray-900);
    transition: border-color 0.15s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--gray-600);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

.form-control:disabled {
    background: var(--gray-100);
    cursor: not-allowed;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.form-inline {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    gap: 6px;
}

.btn svg {
    width: 14px;
    height: 14px;
}

.btn-primary {
    background: var(--black);
    color: var(--white);
    border-color: var(--black);
}

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

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border-color: var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

.btn-success {
    background: var(--success);
    color: var(--white);
    border-color: var(--success);
}

.btn-danger {
    background: var(--white);
    color: var(--danger);
    border-color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: var(--white);
}

.btn-warning {
    background: var(--white);
    color: var(--warning);
    border-color: var(--warning);
}

.btn-warning:hover {
    background: var(--warning);
    color: var(--white);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 14px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Status Badges */
.badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-radius: 3px;
}

.badge-draft { background: var(--gray-200); color: var(--gray-700); }
.badge-submitted { background: #e3f2fd; color: #1565c0; }
.badge-manager_approved { background: #fff3e0; color: #e65100; }
.badge-manager_rejected { background: #ffebee; color: #c62828; }
.badge-finance_approved { background: #e8f5e9; color: #2e7d32; }
.badge-finance_rejected { background: #ffebee; color: #c62828; }
.badge-manager_recheck { background: #fff3e0; color: #e65100; border: 1px dashed #ff9800; }
.badge-finance_recheck { background: #fff3e0; color: #e65100; border: 1px dashed #ff9800; }
.badge-processed { background: #e8f5e9; color: #1b5e20; font-weight: 700; }
.badge-processed { background: var(--black); color: var(--white); }

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 13px;
    border: 1px solid;
}

.alert-success {
    background: #e8f5e9;
    border-color: #a5d6a7;
    color: #2e7d32;
}

.alert-danger {
    background: #ffebee;
    border-color: #ef9a9a;
    color: #c62828;
}

.alert-warning {
    background: #fff3e0;
    border-color: #ffcc80;
    color: #e65100;
}

.alert-info {
    background: #e3f2fd;
    border-color: #90caf9;
    color: #1565c0;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    padding: 16px;
}

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--gray-900);
}

.stat-value.highlight {
    color: var(--danger);
}

/* Discrepancy Highlight */
.discrepancy {
    background: #fff3e0 !important;
}

.discrepancy-icon {
    color: var(--warning);
}

.over-limit {
    color: var(--danger);
    font-weight: 600;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--white);
    border-radius: 6px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

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

.modal-title {
    font-size: 15px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--gray-500);
    padding: 4px;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--gray-300);
    margin-bottom: 0;
    background: var(--white);
    flex-wrap: wrap;
}

.tab {
    padding: 12px 20px;
    font-size: 13px;
    color: var(--gray-600);
    text-decoration: none;
    border: none;
    background: transparent;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab:hover {
    color: var(--gray-900);
    background: var(--gray-50);
}

.tab.active {
    color: var(--black);
    border-bottom-color: var(--black);
    font-weight: 600;
    background: var(--white);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
}

.login-box {
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.login-header p {
    color: var(--gray-500);
    font-size: 13px;
}

/* User Info */
.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    font-size: 12px;
}

.user-avatar {
    width: 28px;
    height: 28px;
    background: var(--gray-300);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 11px;
    color: var(--gray-700);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-500);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    stroke: var(--gray-400);
}

.empty-state h3 {
    font-size: 15px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 4px;
}

/* File Upload */
.file-upload {
    border: 2px dashed var(--gray-300);
    border-radius: 4px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.file-upload:hover {
    border-color: var(--gray-500);
}

.file-upload input {
    display: none;
}

.file-upload-text {
    color: var(--gray-500);
    font-size: 13px;
}

/* Expense Entry Row */
.expense-row {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 12px;
}

.expense-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.expense-row-title {
    font-weight: 500;
    font-size: 13px;
}

/* Summary Box */
.summary-box {
    background: var(--gray-50);
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    padding: 16px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
}

.summary-row.total {
    border-top: 1px solid var(--gray-300);
    margin-top: 8px;
    padding-top: 12px;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Print */
@media print {
    .sidebar, .page-actions, .btn {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
}

/* Utility Classes */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.font-mono { font-family: monospace; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-100 { width: 100%; }