* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Premium Brand-Aligned Palette (Danat Al Uloom) */
    --primary-main: #9f001d; /* Brand Maroon */
    --primary-gradient: linear-gradient(135deg, #9f001d 0%, #7c0017 100%);
    --secondary-main: #302b70; /* Brand Navy Blue */
    --accent-main: #4a449d; 
    --success-main: #059669;
    --warning-main: #d97706;
    --danger-main: #b91c1c;

    /* Highlights (Adaptable for Dark Mode) */
    --brand-title-color: var(--primary-main);
    --table-highlight-primary: var(--primary-main);
    --table-highlight-secondary: var(--secondary-main);

    /* Backgrounds & Surfaces */
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-soft: #f1f5f9;
    --border-color: #e2e8f0;

    /* Text */
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    /* Effects */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-premium: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Animations */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    /* Aliases for backward compatibility */
    --primary: var(--primary-gradient);
    --primary-solid: var(--primary-main);
    --border: var(--border-color);
    --text-dark: var(--text-primary);
    --shadow: var(--shadow-md);
}

.dark-mode {
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-soft: #334155;
    --border-color: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e0;
    --text-muted: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.05);

    /* Highlights Brightened for Dark Mode visibility */
    --brand-title-color: #ff8f8f; /* Brighter, softer red/pink for titles */
    --table-highlight-primary: #f87171; /* Light Red */
    --table-highlight-secondary: #a78bfa; /* Light Purple */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Cairo', sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color var(--transition-base), color var(--transition-base);
    overflow-x: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-full);
    border: 2px solid var(--bg-main);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Navbar Premium Styling */
.navbar {
    background: var(--glass-bg);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: var(--transition-base);
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition-base);
}

.logo:hover {
    transform: scale(1.02);
}

.nav-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-md);
    transition: var(--transition-base);
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    font-size: 0.95rem;
}

.nav-link:hover {
    color: var(--primary-main);
    background: rgba(159, 0, 29, 0.08);
}

.nav-link.active {
    color: var(--primary-main);
    background: rgba(159, 0, 29, 0.12);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 20%;
    right: 20%;
    height: 3px;
    background: var(--primary-gradient);
    border-radius: var(--radius-full) var(--radius-full) 0 0;
}

/* Localhost Warning */
.localhost-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: var(--white);
    padding: 1rem 0;
    box-shadow: var(--shadow-lg);
}

.warning-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.warning-content svg {
    stroke: var(--white);
    flex-shrink: 0;
}

.warning-content>div {
    flex: 1;
    min-width: 300px;
}

.warning-content strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.warning-content p {
    margin: 0;
    opacity: 0.95;
}

.warning-content code {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Main Content */
.main-content {
    padding: 2rem 0;
    min-height: calc(100vh - 80px);
}

.page {
    display: none;
    animation: fadeIn 0.5s ease;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h2 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--secondary);
}

/* Premium Buttons */
.btn {
    padding: 0.8rem 1.75rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(159, 0, 29, 0.25);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(159, 0, 29, 0.35);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--primary-main);
    color: var(--primary-main);
    background: rgba(159, 0, 29, 0.05);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.btn-danger:hover {
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    background: var(--bg-soft);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    border: 1px solid transparent;
}

.btn-icon:hover {
    background: var(--white);
    transform: scale(1.1);
}

/* Table Premium Styling */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th {
    background: var(--bg-soft);
    padding: 1.25rem 1rem;
    text-align: right;
    font-weight: 800;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: var(--transition-fast);
}

.data-table tbody tr:hover {
    background: rgba(159, 0, 29, 0.03);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Dashboards & Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    display: flex;
    gap: 1.25rem;
    align-items: center;
    transition: var(--transition-base);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-gradient);
    opacity: 0;
    transition: var(--transition-base);
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-premium);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
}

.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(5deg);
}

.stat-info h3 {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.stat-number {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -1px;
}

/* Card Styling */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    transition: var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: 1.75rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(var(--primary-main), 0.02);
}

/* Badges Premium */
.status-badge {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-pending {
    background: #fffbeb;
    color: #b45309;
}

.status-pending::before {
    background: #f59e0b;
}

.status-signed {
    background: #ecfdf5;
    color: #047857;
}

.status-signed::before {
    background: #10b981;
}

.status-sent {
    background: #eef2ff;
    color: var(--secondary-main);
}

.status-sent::before {
    background: var(--secondary-main);
}

.status-verified {
    background: #fdf2f8;
    color: #be185d;
}

.status-verified::before {
    background: #db2777;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--secondary);
    cursor: pointer;
    transition: var(--transition);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Form */
.form {
    padding: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    border-radius: var(--radius);
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-solid);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* Notification */
.notification {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--primary-gradient);
    color: white;
    padding: 1rem 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-premium);
    z-index: 10000;
    opacity: 0;
    transition: var(--transition-base);
    font-weight: 600;
    pointer-events: none;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--success);
}

/* Contract Page Styles */
.contract-page {
    background: linear-gradient(135deg, var(--secondary-main) 0%, var(--primary-main) 100%);
}

.contract-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    box-shadow: var(--shadow);
}

.contract-main {
    padding: 2rem 0;
}

.progress-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2rem 0;
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.5;
    transition: var(--transition);
}

.step.active {
    opacity: 1;
}

.step.completed {
    opacity: 1;
}

.step-number {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    transition: var(--transition);
}

.step.active .step-number {
    background: var(--primary);
    color: var(--white);
    box-shadow: var(--shadow-lg);
}

.step.completed .step-number {
    background: var(--success);
    color: var(--white);
}

.step-label {
    font-weight: 600;
    color: var(--dark);
}

.step-line {
    width: 80px;
    height: 3px;
    background: #e5e7eb;
    margin: 0 1rem;
}

.contract-step {
    display: none;
}

.contract-step.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

.contract-card {
    max-width: 800px;
    margin: 0 auto;
}

.contract-details {
    padding: 1.5rem;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-radius: var(--radius);
    margin: 1.5rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 700;
    color: var(--dark);
}

.detail-value {
    color: var(--secondary);
}

/* Settings Page Overhaul Styles */
.settings-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
    padding-bottom: 2px;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: none;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    transition: var(--transition-base);
    font-family: 'Cairo', sans-serif;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.tab-btn:hover {
    color: var(--primary-main);
    background: rgba(99, 102, 241, 0.05);
}

.tab-btn.active {
    color: var(--primary-main);
    background: rgba(99, 102, 241, 0.1);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary-main);
    border-radius: 3px 3px 0 0;
}

/* Tab Content Animation */
.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: block;
}

/* Chip Input UI */
.input-with-btn {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--bg-soft);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    min-height: 60px;
    align-items: flex-start;
}

.chip {
    background: var(--white);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition-fast);
}

.chip:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-main);
}

.chip button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    border-radius: 50%;
    transition: var(--transition-fast);
}

.chip button:hover {
    background: #fee2e2;
    color: #ef4444;
}

.chip-empty {
    width: 100%;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 0.5rem;
}

/* Custom Field Manager */
.custom-field-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    transition: var(--transition-base);
}

.custom-field-item:hover {
    border-color: var(--primary-main);
    box-shadow: var(--shadow-sm);
}

.custom-field-info {
    display: flex;
    flex-direction: column;
}

.custom-field-label {
    font-weight: 700;
    color: var(--text-primary);
}

.custom-field-type {
    font-size: 0.8em;
    color: var(--text-secondary);
}

.contract-content {
    padding: 1.5rem;
}

.contract-viewer {
    height: 300px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    padding: 20px;
    border-radius: 12px;
    background: #f8fafc;
    margin-bottom: 20px;
    font-size: 0.95rem;
    line-height: 1.8;
    text-align: justify;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

/* Fast Flow Specifics */
.fast-flow-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.section-card {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 25px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: transform 0.2s ease;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-title span {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.contract-text {
    background: transparent;
    padding: 0;
    border: none;
    max-height: none;
    overflow-y: visible;
}

.contract-text p {
    margin-bottom: 1rem;
}

.contract-text ul {
    margin: 1rem 0 1rem 2rem;
}

/* Upload Area */
.upload-area {
    border: 3px dashed #e5e7eb;
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    margin: 1.5rem;
    transition: var(--transition);
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--primary-solid);
    background: rgba(102, 126, 234, 0.05);
}

.upload-area h3 {
    margin: 1rem 0 0.5rem;
    color: var(--dark);
}

.upload-area p {
    color: var(--secondary);
    margin-bottom: 1rem;
}

.uploaded-preview {
    margin: 1.5rem;
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: var(--radius);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.preview-content img {
    max-width: 100%;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

/* Signature */
.signature-container {
    margin: 1.5rem;
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: var(--radius);
}

#signatureCanvas {
    width: 100%;
    height: 200px;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius);
    background: var(--white);
    cursor: crosshair;
    touch-action: none;
}

.signature-actions {
    margin-top: 1rem;
}

.checkbox-group {
    padding: 1.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-weight: 600;
}

.checkbox-label input[type="checkbox"] {
    width: 24px;
    height: 24px;
    accent-color: var(--primary-solid);
    cursor: pointer;
}

/* Review Section */
.review-section {
    padding: 1.5rem;
}

.review-item {
    padding: 1rem;
    background: rgba(16, 185, 129, 0.05);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    border-right: 4px solid var(--success);
}

.review-item h3 {
    color: var(--success);
    margin-bottom: 0.5rem;
}

.signature-preview img {
    max-width: 300px;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius);
    margin-top: 0.5rem;
}

.warning-box {
    margin: 1.5rem;
    padding: 1rem 1.5rem;
    background: rgba(245, 158, 11, 0.1);
    border-right: 4px solid var(--warning);
    border-radius: var(--radius);
    display: flex;
    gap: 1rem;
    align-items: start;
}

.warning-box p {
    color: #92400e;
}

/* Success Card */
.success-card {
    text-align: center;
    padding: 3rem 2rem;
}

.success-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    border-radius: 50%;
}

.success-card h2 {
    color: var(--success);
    margin-bottom: 1rem;
}

.success-info {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: var(--radius);
}

/* Bulk Upload */
.upload-instructions {
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.upload-instructions h4 {
    color: #1e40af;
    margin-bottom: 0.75rem;
}

.upload-instructions ul {
    margin-right: 1.5rem;
    color: #3b82f6;
}

.upload-instructions li {
    margin-bottom: 0.5rem;
}

/* Contract Management */
.contracts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.contract-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

.contract-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.contract-card-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.contract-card-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
}

.default-badge {
    padding: 0.25rem 0.75rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: var(--white);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.contract-card-body {
    padding: 1.5rem;
    color: var(--secondary);
    line-height: 1.8;
}

.contract-card-body p {
    margin: 0;
}

.contract-card-footer {
    padding: 1rem 1.5rem;
    background: #fafbfc;
    border-top: 1px solid #f3f4f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.contract-card-footer small {
    color: var(--secondary);
    font-size: 0.85rem;
}

.contract-actions {
    display: flex;
    gap: 0.5rem;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--secondary);
}

.empty-state svg {
    margin-bottom: 1rem;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

/* Input Method Tabs */
.input-method-tabs {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.input-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    background: var(--white);
    border-radius: var(--radius);
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--secondary);
}

.input-tab:hover {
    border-color: var(--primary-solid);
    color: var(--primary-solid);
}

.input-tab.active {
    background: var(--primary);
    border-color: var(--primary-solid);
    color: var(--white);
}

.input-method {
    margin-top: 1.5rem;
}

.input-method textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius);
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    line-height: 1.8;
    resize: vertical;
    transition: var(--transition);
}

.input-method textarea:focus {
    outline: none;
    border-color: var(--primary-solid);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Variables Helper */
.variables-helper {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border: 2px dashed rgba(102, 126, 234, 0.3);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

.variables-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.variables-header strong {
    color: var(--primary-solid);
}

.variables-header small {
    color: var(--secondary);
    font-size: 0.85rem;
}

.variables-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.var-tag {
    padding: 0.4rem 0.8rem;
    background: var(--white);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 20px;
    font-family: 'Cairo', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-solid);
    cursor: pointer;
    transition: var(--transition);
}

.var-tag:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary-solid);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* Contract View */
.contract-view-content {
    background: #f9fafb;
    padding: 2rem;
    border-radius: var(--radius);
    line-height: 1.8;
    white-space: pre-wrap;
    max-height: 500px;
    overflow-y: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .progress-steps {
        overflow-x: auto;
        padding: 1rem;
    }

    .step-line {
        width: 40px;
    }

    .step-label {
        font-size: 0.85rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}

.file-input-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

/* ====================================
   ENHANCED CONTRACTS SECTION STYLES
   ==================================== */

/* Stat Mini Cards */
.stat-mini-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border);
}

.stat-mini-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(102, 126, 234, 0.3);
}

/* Contract Tabs */
.contracts-tabs {
    position: relative;
}

.contract-tab {
    position: relative;
    overflow: hidden;
}

.contract-tab:hover {
    background: rgba(102, 126, 234, 0.05);
}

.contract-tab.active {
    background: rgba(102, 126, 234, 0.08);
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeInUp 0.5s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced Contract Cards Grid */
.contracts-grid {
    animation: fadeIn 0.6s ease;
}

/* Pulse Animation for CTA Button */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 10px 25px rgba(102, 126, 234, 0.2);
    }

    50% {
        transform: scale(1.02);
        box-shadow: 0 15px 35px rgba(102, 126, 234, 0.3);
    }
}

/* Enhanced Contract Card */
.contract-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.contract-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.contract-card:hover::before {
    transform: scaleX(1);
}

.contract-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
    border-color: rgba(102, 126, 234, 0.2);
}

.contract-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border);
}

.contract-card-header h3 {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-dark);
    margin: 0;
}

.default-badge {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.contract-card-body {
    margin-bottom: 1rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.contract-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.contract-actions {
    display: flex;
    gap: 0.5rem;
}

/* Improved Table Styling */
.data-table tbody tr {
    transition: all 0.2s ease;
}

.data-table tbody tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

/* Loading State */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-solid);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.empty-state svg {
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

/* Responsive Improvements */
@media (max-width: 768px) {
    .stat-mini-card {
        padding: 1rem;
    }

    .contracts-tabs {
        gap: 0.5rem;
    }

    .contract-tab {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
    }

    .contracts-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Login Page Enhancements */
#loginOverlay {
    background: var(--bg-soft);
    overflow: hidden;
}

#loginOverlay::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('assets/login-bg.jpg'), linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.2;
    z-index: 0;
}

#loginOverlay .card {
    position: relative;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.dark-mode #loginOverlay .card {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Chips and Management UI */
.chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
    min-height: 40px;
}

.chip {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    color: #334155;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.chip:hover {
    background: #e2e8f0;
    border-color: #cbd5e0;
}

.chip span {
    margin-left: 8px;
}

.chip button {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.chip button:hover {
    color: #ef4444;
}

.chip-empty {
    color: #94a3b8;
    font-style: italic;
    font-size: 0.9rem;
    padding: 10px 0;
}

/* Custom Fields List */
#customFieldsList {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.custom-field-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: var(--radius);
    border: 1px solid #e2e8f0;
    transition: border-color 0.2s;
}

.custom-field-item:hover {
    border-color: var(--primary-main);
    background: #fff;
}

.custom-field-info {
    display: flex;
    flex-direction: column;
}

.custom-field-label {
    font-weight: 700;
    color: var(--dark);
}

.custom-field-type {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.input-with-btn {
    display: flex;
    gap: 0.75rem;
}

.input-with-btn input,
.input-with-btn select {
    flex: 1;
}

/* Mobile Bottom Navigation Styles */
@media (max-width: 768px) {
    .navbar .nav-links .nav-link:not(.logout-nav) {
        display: none !important;
    }

    .mobile-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 65px;
        background: #ffffff;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        z-index: 1000;
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
        border-top: 1px solid #e2e8f0;
    }

    .dark-mode .mobile-nav {
        background: #1e293b;
        border-top-color: #334155;
    }

    body {
        padding-bottom: 75px !important;
    }
}

.mobile-nav {
    display: none !important;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #64748b;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 700;
    gap: 4px;
    width: 25%;
    transition: all 0.2s ease;
}

.mobile-nav-item.active {
    color: #1e3a8a;
}

.dark-mode .mobile-nav-item.active {
    color: #6366f1;
}

.logout-nav {
    margin-right: auto;
}

/* SMS Quick Action Styles */
.sms-quick {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
.sms-quick:hover {
    background-color: #0284c7 !important;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 15px rgba(14, 165, 233, 0.35) !important;
}
.sms-quick:active {
    transform: translateY(0) scale(0.95);
}
.action-dropdown-item[onclick*='sendSMS']:hover {
    background-color: rgba(14, 165, 233, 0.08) !important;
    color: #0ea5e9 !important;
}