/* ============================================
   CSS Variables & Reset - Glassmorphism Design
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Glassmorphism Color Palette */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #818cf8;
    --primary-dark: #3730a3;
    --secondary: #0f172a;
    --secondary-light: #1e293b;
    --success: #10b981;
    --success-light: #34d399;
    --danger: #ef4444;
    --danger-light: #f87171;
    --warning: #f59e0b;
    --warning-light: #fbbf24;
    --info: #06b6d4;
    --info-light: #22d3ee;

    /* Glass Backgrounds */
    --bg-main: #0f172a;
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --bg-sidebar: rgba(15, 23, 42, 0.8);
    --bg-sidebar-hover: rgba(99, 102, 241, 0.15);
    --bg-glass: rgba(255, 255, 255, 0.1);
    --bg-glass-dark: rgba(0, 0, 0, 0.2);

    /* Text Colors for Dark Theme */
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-light: #ffffff;

    /* Glass Effects */
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --glass-blur: blur(4px);

    /* Border & Radius */
    --border-color: rgba(255, 255, 255, 0.1);
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --border-radius-sm: 8px;

    /* Shadows */
    --shadow-sm: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --header-height: 60px;
    --transition: all 0.3s ease;
    --transition-fast: all 0.15s ease;
}

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

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-main);
    background-image:
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.1) 0px, transparent 50%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p { color: var(--text-secondary); }

.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

/* ============================================
   Login Page
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
    padding: 1rem;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-box {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
}

.login-box h1 {
    text-align: center;
    color: var(--primary);
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.login-box .subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

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

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-light);
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: var(--transition);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

/* Collapsed Sidebar */
.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

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

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

.sidebar-brand .logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar-brand h2 {
    color: var(--text-light);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
    transition: var(--transition);
}

.sidebar.collapsed .sidebar-brand h2 {
    opacity: 0;
    width: 0;
}

.sidebar-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-light);
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-toggle:focus {
    outline: 2px solid rgba(255, 255, 255, 0.3);
    outline-offset: 2px;
}

.sidebar-toggle svg {
    width: 18px;
    height: 18px;
    transition: var(--transition);
}

.sidebar.collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
    overflow-x: hidden;
}

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

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

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

.sidebar-nav ul {
    list-style: none;
    padding: 0 0.75rem;
}

.sidebar-nav li {
    margin-bottom: 0.25rem;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: var(--transition-fast);
    border-radius: var(--border-radius);
    position: relative;
    overflow: hidden;
}

.sidebar-nav li a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-light);
}

.sidebar-nav li.active a {
    background: var(--primary);
    color: var(--text-light);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.sidebar-nav li a .nav-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.sidebar-nav li a .nav-icon svg {
    width: 20px;
    height: 20px;
}

.sidebar-nav li a .nav-text {
    margin-left: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    transition: var(--transition);
}

.sidebar.collapsed .sidebar-nav li a .nav-text {
    opacity: 0;
    width: 0;
    margin-left: 0;
}

/* Tooltip for collapsed sidebar */
.sidebar.collapsed .sidebar-nav li a {
    justify-content: center;
}

.sidebar.collapsed .sidebar-nav li a::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    background: var(--secondary);
    color: var(--text-light);
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-fast);
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.sidebar.collapsed .sidebar-nav li a:hover::after {
    opacity: 1;
    visibility: visible;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--success), #059669);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.user-details {
    overflow: hidden;
    transition: var(--transition);
}

.user-details .user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-details .user-role {
    font-size: 0.7rem;
    color: var(--primary-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar.collapsed .user-details {
    opacity: 0;
    width: 0;
}

.sidebar.collapsed .user-info-card {
    justify-content: center;
    padding: 0.5rem;
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.625rem;
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    text-decoration: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    font-size: 0.875rem;
    transition: var(--transition-fast);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.logout-btn:hover {
    background: var(--danger);
    color: var(--text-light);
    border-color: var(--danger);
}

.logout-btn svg {
    width: 18px;
    height: 18px;
}

.logout-btn .logout-text {
    transition: var(--transition);
}

.sidebar.collapsed .logout-btn .logout-text {
    display: none;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 101;
    width: 44px;
    height: 44px;
    background: var(--bg-sidebar);
    border: none;
    border-radius: var(--border-radius);
    color: var(--text-light);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

.mobile-menu-btn svg {
    width: 24px;
    height: 24px;
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ============================================
   Main Content Area
   ============================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 1.5rem 2rem;
    min-height: 100vh;
    transition: var(--transition);
}

body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.page-header p {
    margin-top: 0.25rem;
    color: var(--text-secondary);
}

/* ============================================
   Cards - Glassmorphism Style
   ============================================ */
.card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: var(--transition);
}

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

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: var(--glass-border);
    background: rgba(255, 255, 255, 0.03);
}

/* ============================================
   Form Elements
   ============================================ */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: var(--glass-border);
    border-radius: var(--border-radius);
    font-size: 0.9375rem;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2), var(--shadow-glow);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.form-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

/* Checkbox Group */
.checkbox-group {
    margin-top: 0.5rem;
}

.checkbox-group .section-label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
}

.checkbox-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 400;
    color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border: var(--glass-border);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--text-light);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.5);
}

.btn-primary:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3), var(--shadow-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--text-muted);
    color: var(--text-light);
}

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

.btn-secondary:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.2);
}

.btn-secondary:active {
    transform: translateY(0);
}

.btn-success {
    background: var(--success);
    color: var(--text-light);
}

.btn-success:hover {
    background: #059669;
}

.btn-success:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--success-light);
}

.btn-success:active {
    transform: translateY(0);
}

.btn-danger {
    background: var(--danger);
    color: var(--text-light);
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-danger:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--danger-light);
}

.btn-danger:active {
    transform: translateY(0);
}

.btn-warning {
    background: var(--warning);
    color: var(--text-light);
}

.btn-warning:hover {
    background: #d97706;
}

.btn-warning:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--warning-light);
}

.btn-warning:active {
    transform: translateY(0);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: var(--bg-main);
    border-color: var(--text-secondary);
}

.btn-outline:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(226, 232, 240, 0.5);
}

.btn-outline:active {
    transform: translateY(0);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

/* Edit button specific style */
.btn-edit {
    background: var(--warning);
    color: var(--text-light);
}

.btn-edit:hover {
    background: #d97706;
}

.btn-edit:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--warning-light);
}

.btn-delete {
    background: var(--danger);
    color: var(--text-light);
}

.btn-delete:hover {
    background: #dc2626;
}

.btn-delete:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--danger-light);
}

/* ============================================
   Alerts
   ============================================ */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideDown 0.3s ease;
}

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

.alert-success {
    background: var(--success-light);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: var(--danger-light);
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: var(--warning-light);
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-info {
    background: var(--info-light);
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* ============================================
   Tables
   ============================================ */
.table-container {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

.data-table th,
.data-table td {
    padding: 1rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--bg-main);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
}

.data-table tbody tr {
    transition: var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--primary-light);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table .actions {
    white-space: nowrap;
    display: flex;
    gap: 0.5rem;
}

.data-table .no-data {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 1rem;
}

/* Special cells */
.tin-number {
    font-family: 'Consolas', 'Monaco', monospace;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 0.5px;
}

.row-closed {
    background-color: var(--danger-light) !important;
}

.row-closed:hover {
    background-color: #fecaca !important;
}

.checkbox-cell {
    text-align: center;
}

.check-yes {
    color: var(--success);
    font-weight: 600;
}

.check-no {
    color: var(--text-muted);
}

/* CR Cell & Dropdown */
.cr-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.main-cr {
    font-family: 'Consolas', 'Monaco', monospace;
    font-weight: 500;
    color: var(--text-primary);
}

.cr-dropdown {
    position: relative;
    display: inline-block;
}

.cr-toggle {
    background: var(--primary-light);
    color: var(--primary);
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.cr-toggle:hover {
    background: var(--primary);
    color: var(--text-light);
}

.cr-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    padding: 0.5rem;
    min-width: 150px;
    z-index: 50;
    margin-top: 0.25rem;
}

.cr-dropdown.open .cr-dropdown-content {
    display: block;
}

.cr-dropdown-content span {
    display: block;
    padding: 0.375rem 0.5rem;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.cr-dropdown-content span:last-child {
    border-bottom: none;
}

/* CR Input Fields (Forms) */
.cr-inputs-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cr-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.cr-input-row input {
    flex: 1;
}

.cr-input-row .btn {
    flex-shrink: 0;
}

.add-cr-btn {
    margin-top: 0.5rem;
}

/* Note Cell */
.note-cell {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
    cursor: default;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-opened {
    background: var(--success-light);
    color: #065f46;
}

.status-closed {
    background: var(--danger-light);
    color: #991b1b;
}

/* Task Status Badges */
.status-pending {
    background: var(--warning-light);
    color: #92400e;
}

.status-inprocess {
    background: var(--info-light);
    color: #1e40af;
}

.status-completed {
    background: var(--success-light);
    color: #065f46;
}

.status-rejected {
    background: var(--danger-light);
    color: #991b1b;
}

.status-partially_processed {
    background: #fef3c7;
    color: #d97706;
}

.status-partially_completed {
    background: #d1fae5;
    color: #059669;
}

/* Task Table Specific Styles */
.row-completed {
    background: rgba(16, 185, 129, 0.05);
}

.row-rejected {
    background: rgba(239, 68, 68, 0.05);
}

.amount-cell {
    font-family: 'Monaco', 'Menlo', monospace;
    text-align: right;
    white-space: nowrap;
}

.paid-amount {
    color: var(--success);
    font-weight: 600;
}

.badge-changed {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: var(--warning);
    color: white;
    border-radius: 50%;
    font-size: 0.7rem;
    margin-left: 4px;
    font-weight: bold;
}

.form-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Payment Status Badges */
.payment-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.payment-not_paid {
    background: rgba(16, 185, 129, 0.15);
    color: #065f46;
}

.payment-partially_paid {
    background: var(--warning-light);
    color: #92400e;
}

/* ============================================
   Modals
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 550px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

.modal-content.modal-small {
    max-width: 420px;
}

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

.modal-header h2 {
    font-size: 1.25rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    transition: var(--transition-fast);
}

.close-btn:hover {
    background: var(--bg-main);
    color: var(--danger);
}

.modal-content form {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.confirm-text {
    text-align: center;
    padding: 1.5rem;
    font-size: 1rem;
    color: var(--text-primary);
}

/* ============================================
   View Modal Details
   ============================================ */
.view-details {
    padding: 0.25rem 0;
}

.view-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1.5rem;
}

.view-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.6rem 0.75rem;
    background: rgba(255,255,255,0.04);
    border-radius: var(--border-radius-sm);
    border-left: 3px solid var(--primary);
}

.view-row-full {
    grid-column: 1 / -1;
}

.view-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.view-value {
    font-size: 0.95rem;
    color: var(--text-primary);
    word-break: break-all;
}

.view-password {
    font-family: 'Consolas', 'Monaco', monospace;
    letter-spacing: 0.05em;
    color: var(--warning);
}

.cr-badge {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.2rem 0.5rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.85rem;
    margin: 0.15rem 0.25rem 0.15rem 0;
    font-family: 'Consolas', 'Monaco', monospace;
}

.cr-badge small {
    font-size: 0.7rem;
    opacity: 0.75;
}

/* ============================================
   Stats Grid (Dashboard)
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

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

.stat-card.wide {
    grid-column: span 2;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-right: 1rem;
    color: var(--text-light);
}

.brokers-icon { background: linear-gradient(135deg, var(--primary), var(--primary-hover)); }
.tins-icon { background: linear-gradient(135deg, var(--warning), #d97706); }
.opened-icon { background: linear-gradient(135deg, var(--success), #059669); }
.closed-icon { background: linear-gradient(135deg, var(--danger), #dc2626); }
.balance-icon { background: linear-gradient(135deg, var(--secondary), var(--secondary-light)); }

.stat-info h3 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-info p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* ============================================
   Dashboard Sections
   ============================================ */
.dashboard-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
}

.section-card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.section-card h2 {
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary);
    font-size: 1.125rem;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: var(--primary);
    color: var(--text-light);
    text-decoration: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    font-size: 0.875rem;
    transition: var(--transition);
}

.action-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* ============================================
   Placeholder Content
   ============================================ */
.placeholder-content {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 4rem 2rem;
    text-align: center;
    box-shadow: var(--shadow);
    margin-top: 2rem;
}

.placeholder-content p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* ============================================
   Table Scrollbar Customization
   ============================================ */
.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: var(--bg-main);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
    transition: var(--transition-fast);
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   Employee Dashboard
   ============================================ */
.employee-container {
    min-height: 100vh;
    background: var(--bg-main);
}

.employee-header {
    background: var(--secondary);
    color: var(--text-light);
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

.employee-header h1 {
    color: var(--text-light);
    font-size: 1.5rem;
}

.employee-header .user-section {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.employee-main {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.welcome-card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.welcome-card h2 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.employee-content {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1024px) {
    .sidebar:not(.collapsed) {
        width: 240px;
    }

    .main-content {
        margin-left: 240px;
        padding: 1.25rem 1.5rem;
    }

    body.sidebar-collapsed .main-content {
        margin-left: var(--sidebar-collapsed-width);
    }
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
        z-index: 1001;
    }

    .sidebar {
        position: fixed;
        left: -100%;
        width: 280px !important;
        transition: left 0.3s ease;
        z-index: 1002;
    }

    .sidebar.mobile-open {
        left: 0;
    }

    .sidebar.collapsed {
        width: 280px !important;
    }

    .sidebar.collapsed .sidebar-brand h2,
    .sidebar.collapsed .sidebar-nav li a .nav-text,
    .sidebar.collapsed .user-details,
    .sidebar.collapsed .logout-btn .logout-text {
        opacity: 1;
        width: auto;
        margin-left: 0.75rem;
    }

    .sidebar.collapsed .sidebar-nav li a {
        justify-content: flex-start;
    }

    .sidebar.collapsed .user-info-card {
        justify-content: flex-start;
        padding: 0.75rem;
    }

    .sidebar-toggle {
        display: none;
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
        padding-top: 4.5rem;
        width: 100%;
    }

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

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
    }

    .stat-card.wide {
        grid-column: span 1;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-sections {
        grid-template-columns: 1fr;
    }

    .data-table th,
    .data-table td {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }

    .modal-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }

    .modal-content.modal-large {
        max-width: 100%;
    }

    .checkbox-row {
        flex-direction: column;
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 13px;
    }

    .login-box {
        padding: 1.5rem;
    }

    .main-content {
        padding: 0.75rem;
        padding-top: 4.5rem;
    }

    .table-container {
        border-radius: var(--border-radius);
    }

    .data-table th,
    .data-table td {
        padding: 0.625rem 0.75rem;
    }

    .btn {
        padding: 0.5rem 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }

    .stat-info h3 {
        font-size: 1.5rem;
    }
}

/* ============================================
   Result Display Styles
   ============================================ */
.result-details-grid {
    display: grid;
    gap: 1.5rem;
}

.result-section {
    background: var(--bg-main);
    border-radius: var(--border-radius);
    padding: 1.25rem;
}

.result-section h4 {
    font-size: 1rem;
    color: var(--primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-light);
}

.amount-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.amount-item {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.amount-item label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.amount-item .amount {
    font-size: 1.25rem;
    font-weight: 600;
    font-family: 'Monaco', 'Menlo', monospace;
    color: var(--text-primary);
}

.info-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.info-item {
    background: var(--bg-card);
    padding: 0.75rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.info-item label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.info-item .value {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-family: 'Consolas', 'Monaco', monospace;
}

.result-note {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--border-radius);
    border-left: 3px solid var(--primary);
    margin-top: 1rem;
}

.result-note label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.result-note .value {
    color: var(--text-secondary);
    line-height: 1.6;
    white-space: pre-wrap;
}

/* ============================================
   Utility Classes
   ============================================ */
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.p-0 { padding: 0; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.d-flex { display: flex; }
.d-block { display: block; }
.d-none { display: none; }

/* ============================================
   Glassmorphism Utility Classes
   ============================================ */
.glass {
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.glass-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

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

.glass-overlay {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.gradient-border {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 2px;
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--border-radius);
    padding: 2px;
    background: linear-gradient(135deg, var(--primary), var(--info));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

.glow {
    box-shadow: var(--shadow-glow);
}

.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.rounded { border-radius: var(--border-radius); }
.rounded-lg { border-radius: var(--border-radius-lg); }
.shadow { box-shadow: var(--shadow); }
.shadow-md { box-shadow: var(--shadow-md); }
