:root {
    /* Color Palette - Slate & Blue-Gray */
    --primary: #2563eb;
    /* Royal Blue */
    --primary-hover: #1d4ed8;
    --secondary: #64748b;
    /* Slate 500 */

    --success: #10b981;
    /* Emerald 500 */
    --warning: #f59e0b;
    /* Amber 500 */
    --danger: #ef4444;
    /* Red 500 */

    --bg-body: #f3f4f6;
    /* Light Gray */
    --bg-card: #ffffff;
    --bg-header: #0f172a;
    /* Navy Blue */

    --text-main: #0f172a;
    /* Slate 900 */
    --text-muted: #64748b;
    /* Slate 500 */
    --border: #e2e8f0;
    /* Slate 200 */

    --radius: 0.5rem;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

/* Auth Layout (Login) */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f1f5f9;
}

.auth-card {
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-title {
    font-size: 1.5rem;
    color: var(--primary);
    margin: 0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Navigation */
.navbar {
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.navbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    /* White Brand */
    text-decoration: none;
    letter-spacing: -0.025em;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: #cbd5e1;
    /* Light Gray Text */
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: #ffffff;
    /* White on Hover */
}

.nav-links span {
    font-size: 0.9rem;
    color: var(--text-main);
    font-weight: 600;
    background: #eff6ff;
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
}

/* Typography */
h1 {
    font-size: 1.875rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

p.lead {
    font-size: 1.125rem;
    color: var(--text-muted);
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

/* Full Height Table Container */
.table-container-full {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    height: 75vh;
    /* 75% of viewport height (Leaving ~25% for header) */
    overflow: auto;
    position: relative;
}

.table-container-full table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-container-full th {
    position: sticky;
    top: 0;
    background-color: var(--bg-card);
    z-index: 10;
    box-shadow: 0 1px 0 var(--border);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    vertical-align: middle;
}

tbody tr:hover {
    background-color: #f8fafc;
    /* Subtle hover */
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    font-weight: 600;
    font-size: 0.925rem;
    border-radius: var(--radius);
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-success:hover {
    background-color: #059669;
    /* Emerald 600 */
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-secondary {
    background-color: white;
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: #f1f5f9;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-main);
    background-color: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Modals */
.modal-backdrop {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(15, 23, 42, 0.6);
    /* Darker backdrop */
    backdrop-filter: blur(4px);
    /* Blur effect */
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background-color: white;
    margin: 3% auto;
    padding: 2rem;
    border: 1px solid var(--border);
    width: 90%;
    max-width: 600px;
    /* Default width */
    border-radius: 0.75rem;
    /* Larger radius for modern look */
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease-out;
    position: relative;
}

.modal-content.modal-lg {
    max-width: 1000px;
    height: 90vh;
    /* For PDF viewer */
    display: flex;
    flex-direction: column;
}

.modal-content.modal-full {
    width: 98%;
    max-width: 98%;
    height: 98vh;
    margin: 1vh auto;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.modal-body-scroll {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
    min-height: 150px;
    border: 1px solid var(--border);
}

.close-btn {
    color: var(--text-muted);
    float: right;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--text-main);
}

/* Status Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Modern Utilities & Refinements - Premium Edition */
.glass {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(209, 213, 219, 0.3);
}

.card-premium {
    background: white;
    border: 1px solid var(--border);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.card-premium:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: var(--primary);
}

.gradient-primary { background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%); }
.gradient-success { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.gradient-purple { background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%); }

.text-gradient {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

/* Modal Layout State-of-the-Art */
.modal-header-premium {
    padding: 1.25rem 2rem;
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 1rem 1rem 0 0;
}

.modal-split {
    display: flex;
    height: calc(100% - 70px); /* Subtract header height */
    overflow: hidden;
}

.modal-split-preview {
    flex: 1.3;
    background: #0f172a;
    position: relative;
    border-right: 1px solid var(--border);
}

.modal-split-form {
    flex: 0.7;
    background: white;
    padding: 2.5rem;
    overflow-y: auto;
}

@media (max-width: 1100px) {
    .modal-split {
        flex-direction: column;
    }
    .modal-split-preview {
        flex: none;
        height: 350px;
    }
}

.close-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f1f5f9;
    color: var(--secondary);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.5rem;
    margin-left: auto; /* Force to right in flex */
}

.close-btn:hover {
    background: #fee2e2;
    color: #ef4444;
    transform: rotate(90deg);
}

/* Form refinement */
.form-control {
    border: 1px solid #e2e8f0;
    padding: 0.85rem 1rem;
    font-size: 0.9rem;
}

/* Status specific improvements */
.status-pill {
    padding: 0.4rem 1rem;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Validation Feedback */
.form-control.is-invalid {
    border-color: var(--danger);
}
.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}
.invalid-feedback {
    display: block;
    color: var(--danger);
    font-size: 0.825rem;
    margin-top: 0.25rem;
    font-weight: 500;
}