/* --- MODERN DESIGN TOKENS --- */
:root {
    --color-primary-main: #0F172A;
    --color-primary-light: #334155;
    --color-primary-surface: #F1F5F9;
    --color-accent-blue: #3B82F6;
    --color-accent-blue-soft: #EFF6FF;
    --color-bg-app: #F8FAFC;
    --color-white: #FFFFFF;
    --color-active: #96989b1f;
    --color-text-main: #1E293B;
    --color-text-muted: #64748B;

    --border-subtle: rgba(0, 0, 0, 0.06);
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-card: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    --shadow-popover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --radius-main: 16px;
    --radius-sm: 8px;

    /* Dimensions */
    --sidebar-width: 100px;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--color-text-main);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    background-image: linear-gradient(45deg, rgba(48, 142, 135, 0.12) 20.35%, rgba(243, 145, 89, 0.1) 50%, rgba(2, 162, 185, 0.12) 100%);
}

/* --- LAYOUT --- */
.app-container {
    display: flex;
    height: 100vh;
    width: 100%;
    position: relative;
    /* For mobile positioning context */
    background-image: linear-gradient(45deg, rgba(48, 142, 135, 0.12) 20.35%, rgba(243, 145, 89, 0.1) 50%, rgba(2, 162, 185, 0.12) 100%);
}

/* 1. ELEGANT SIDEBAR */
.rail-nav {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    /* FIX: Prevent flex shrinking */
    background-color: rgba(255, 255, 255, 0.95);
    /* Less translucent for better readability */
    backdrop-filter: blur(12px);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 2rem 1.5rem;
    flex-shrink: 0;
    z-index: 2000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible;
    border-right: 1px solid rgba(0, 0, 0, 0.05);
}

.rail-nav.collapsed {
    transform: translateX(-100%);
    margin-right: calc(var(--sidebar-width) * -1);
}

/* --- LOGO AREA --- */
.logo-area {
    margin-bottom: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.logo-sm {
    display: block;
}

.rail-logo {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--color-primary-main), #1e293b);
    color: white;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    box-shadow: 0 10px 20px -5px rgba(15, 23, 42, 0.4);
}

.logo-lg {
    display: none;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-primary-main);
    letter-spacing: -0.5px;
    white-space: nowrap;
}

/* Rail Items */
.rail-link {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    border-radius: 14px;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
    text-decoration: none;
    font-size: 1.25rem;
    position: relative;
}

.rail-link:hover,
.rail-link[aria-expanded="true"] {
    color: var(--color-accent-blue);
    background-color: var(--color-accent-blue-soft);
    transform: translateY(-2px);
}

.rail-link.active {
    color: var(--color-accent-blue);
    background-color: var(--color-accent-blue-soft);
}

.rail-link.active::after {
    content: '';
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    height: 6px;
    width: 6px;
    background-color: var(--color-accent-blue);
    border-radius: 50%;
}

/* --- FIXED SUB MENU POSITIONING (BULLETPROOF) --- */
.dropend {
    /* Position relative to contain the absolute menu */
    position: relative;
    width: 100%;
    /* Spans the full 80px width of the sidebar */
    justify-content: center;
    margin-bottom: 0.75rem;
}

.dropend .rail-link {
    margin-bottom: 0;
}

.rail-dropdown-menu {
    position: absolute !important;
    top: 0 !important;
    left: 100% !important;
    /* Starts exactly at the right edge of sidebar (80px) */
    margin-left: 10px !important;
    /* Adds a gap */

    transform: none !important;
    /* Disables Popper.js transforms */

    border: none;
    box-shadow: var(--shadow-popover);
    border-radius: 12px;
    padding: 1rem;
    min-width: 220px;
    background: white;
    z-index: 99999;

    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
    transform: translateX(-10px) !important;
}

.rail-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(0) !important;
}

/* Arrow pointing left to the icon */
.rail-dropdown-menu::before {
    content: '';
    position: absolute;
    top: 20px;
    left: -6px;
    width: 12px;
    height: 12px;
    background: white;
    transform: rotate(45deg);
    border-radius: 2px;
    box-shadow: -2px 2px 5px rgba(0, 0, 0, 0.03);
    z-index: -1;
}

/* --- NEW: BOTTOM-UP MENU VARIANT --- */
.rail-dropdown-menu.rail-dropdown-menu-up {
    top: auto !important;
    bottom: 0 !important;
    transform-origin: bottom left;
}

/* Adjust arrow for bottom-up menu */
.rail-dropdown-menu.rail-dropdown-menu-up::before {
    top: auto;
    bottom: 20px;
    /* Centers with the 50px icon at the bottom */
}

.dropdown-header {
    color: var(--color-accent-blue);
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 0.5rem 1rem;
}

.dropdown-item {
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    transition: all 0.2s;
}

.dropdown-item i {
    width: 20px;
    text-align: center;
    margin-right: 10px;
    font-size: 0.85rem;
}

.dropdown-item:hover {
    background-color: var(--color-bg-app);
    color: var(--color-primary-main);
    transform: translateX(4px);
}

.dropdown-divider {
    margin: 0.5rem 0;
    border-top: 1px solid var(--border-subtle);
}

/* 2. MASTER PANE */
.master-pane {
    width: 40vw;
    background-color: var(--color-white);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 1030;
    transition: margin-left 0.3s ease, width 0.3s ease;
}

.master-pane.hidden {
    margin-left: -360px;
}

.master-pane.expanded {
    width: auto;
    flex: 1;
    border-right: none;
    background: transparent;
}

.master-pane.expanded .list-container {
    width: calc(100vw - var(--sidebar-width));
    max-width: 100%;
    /* Full width inside pane */
    padding: 2rem;
    /* Add padding for org chart */
}

.search-header {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* --- UNIFIED FORM INPUT STYLING (Including Time) --- */
.modern-search {
    background-color: var(--color-bg-app);
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    font-size: 0.9rem;
    transition: all 0.2s;
    height: 46px;
}

.modern-search:focus {
    background-color: white;
    border-color: var(--color-accent-blue);
    box-shadow: 0 0 0 3px var(--color-accent-blue-soft);
    outline: none;
}

/* Unified style for Text, Number, Date, Time, Select */
.form-control-theme {
    background-color: var(--color-bg-app) !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 12px !important;
    padding: 0.6rem 1rem !important;
    font-size: 0.9rem !important;
    transition: all 0.2s;
    height: 46px !important;
    /* Force Height Consistency */
    width: 100%;
    color: var(--color-text-main) !important;
    line-height: 1.5;
    /* Ensure text centers vertically */
}

.form-control-theme:focus {
    background-color: white !important;
    border-color: var(--color-accent-blue) !important;
    box-shadow: 0 0 0 3px var(--color-accent-blue-soft) !important;
    outline: none;
}

/* Specific fix for Flatpickr Time input to ensure it doesn't shrink */
input.flatpickr-time,
input.flatpickr-input {
    height: 46px !important;
    min-height: 46px !important;
    display: block !important;
    padding: 0.6rem 1rem !important;
    /* Enforce padding matches date */
}

.list-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem;
}

.candidate-item {
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid transparent;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
}

.candidate-item:hover {
    background-color: var(--color-bg-app);
}

.candidate-item.active {
    background-color: var(--color-active);
    border-color: var(--border-subtle);
    box-shadow: var(--shadow-soft);
}

.candidate-item.active h6 {
    color: var(--color-accent-blue) !important;
}

/* 3. DETAIL VIEW */
.detail-pane {
    flex-grow: 1;
    overflow-y: auto;
    padding: 2.5rem;
}

/* --- COMPONENTS --- */
.btn {
    border-radius: 10px;
    font-weight: 600;
    padding: 0.6rem 1.2rem;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.btn-primary {
    background-color: var(--color-primary-main);
    border-color: var(--color-primary-main);
    box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.2);
}

.btn-primary:hover {
    background-color: #334155;
    border-color: #334155;
    transform: translateY(-1px);
}

.btn-accent {
    background-color: var(--color-accent-blue);
    color: white;
    border: none;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.btn-accent:hover {
    background-color: #2563EB;
    color: white;
    transform: translateY(-1px);
}

.btn-outline-secondary {
    border-color: #CBD5E1;
    color: var(--color-text-muted);
}

.btn-outline-secondary:hover {
    background-color: var(--color-bg-app);
    color: var(--color-text-main);
    border-color: #94A3B8;
}

.card-custom {
    background: var(--color-white);
    border: none;
    border-radius: var(--radius-main);
    box-shadow: var(--shadow-card);
    margin-bottom: 2rem;
    padding: 2rem;
}

.status-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.35em 0.8em;
    border-radius: 20px;
}

.badge-warning {
    background-color: #FFF7ED;
    color: #EA580C;
}

.badge-success {
    background-color: #F0FDF4;
    color: #16A34A;
}

.badge-danger {
    background-color: #FEF2F2;
    color: #DC2626;
}

.badge-info {
    background-color: #EFF6FF;
    color: #2563EB;
}

.text-header-modern {
    color: var(--color-primary-main);
    font-weight: 700;
    letter-spacing: -0.5px;
}

.text-label-modern {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    color: #94A3B8;
}

.data-value {
    font-size: 0.95rem;
    color: var(--color-text-main);
    font-weight: 500;
}

.data-row {
    padding: 1rem 0;
    border-bottom: 1px solid var(--color-bg-app);
}

/* --- FIX: MAP WRAPPER & FILE UPLOAD --- */
.map-wrapper {
    position: relative;
    width: 100%;
    height: 240px;
    border-radius: 12px;
    overflow: hidden;
    background-color: #e2e8f0;
    border: 1px solid #e2e8f0;
}

.map-wrapper iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.custom-file-upload {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border: 2px dashed var(--border-subtle);
    border-radius: 16px;
    background-color: var(--color-bg-app);
    transition: all 0.2s ease;
    cursor: pointer;
    text-align: center;
}

.custom-file-upload:hover {
    border-color: var(--color-accent-blue);
    background-color: var(--color-accent-blue-soft);
}

.custom-file-upload i {
    font-size: 2rem;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
    transition: color 0.2s;
}

.custom-file-upload:hover i {
    color: var(--color-accent-blue);
}

.file-input-hidden {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

/* --- TODO LIST STYLES --- */
.todo-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--color-bg-app);
    transition: all 0.2s;
}

.todo-item:last-child {
    border-bottom: none;
}

.todo-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.todo-item.completed .todo-checkbox {
    background-color: var(--color-accent-blue);
    border-color: var(--color-accent-blue);
}

.todo-item.completed .todo-text {
    text-decoration: line-through;
    color: var(--color-text-muted);
}

.todo-checkbox i {
    color: white;
    font-size: 0.7rem;
    display: none;
}

.todo-item.completed .todo-checkbox i {
    display: block;
}


/* --- ORG CHART TREE CSS --- */
.org-tree-wrapper {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2rem;
    display: flex;
    justify-content: center;
}

/* --- NEW: ABSTRACT BACKGROUND CONTAINER FOR ORG CHART --- */
.org-chart-container {
    position: relative;
    background-color: rgba(248, 250, 252, 0.6);
    /* Translucent */
    /* Technical Dot Grid Pattern */
    background-image:
        radial-gradient(#CBD5E1 1px, transparent 1px),
        radial-gradient(#CBD5E1 1px, transparent 1px);
    background-size: 24px 24px;
    background-position: 0 0, 12px 12px;

    border-radius: 24px;
    padding: 3rem 1rem;
    overflow: hidden;
    /* Clip the glow */
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: inset 0 0 40px rgba(255, 255, 255, 0.5);
}

/* Abstract Glow behind CEO */
.org-chart-container::before {
    content: '';
    position: absolute;
    top: -150px;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 600px;
    /* Soft Blue Glow */
    background: radial-gradient(50% 50% at 50% 50%, rgba(59, 130, 246, 0.15) 0%, rgba(255, 255, 255, 0) 100%);
    z-index: 1;
    pointer-events: none;
}

.org-tree ul {
    padding-top: 20px;
    position: relative;
    transition: all 0.5s;
    display: flex;
    justify-content: center;
    padding-left: 0;
}

/* NEW: Specific style for tree branch with assistant */
/* FIX: Increased padding to push children down further, preventing overlap */
.org-tree ul.has-assistant {
    padding-top: 150px !important;
}

/* FIX: Extended vertical line to match new padding */
.org-tree ul.has-assistant::before {
    height: 150px !important;
}

.org-tree li {
    float: left;
    text-align: center;
    list-style-type: none;
    position: relative;
    padding: 20px 10px 0 10px;
    transition: all 0.5s;
}

/* Connector lines */
.org-tree li::before,
.org-tree li::after {
    content: '';
    position: absolute;
    top: 0;
    right: 50%;
    border-top: 2px solid #cbd5e1;
    width: 50%;
    height: 20px;
}

.org-tree li::after {
    right: auto;
    left: 50%;
    border-left: 2px solid #cbd5e1;
}

/* Remove connectors for single children */
.org-tree li:only-child::after,
.org-tree li:only-child::before {
    display: none;
}

.org-tree li:only-child {
    padding-top: 0;
}

/* Remove outer connectors */
.org-tree li:first-child::before,
.org-tree li:last-child::after {
    border: 0 none;
}

/* Add vertical connectors back for first/last nodes */
.org-tree li:last-child::before {
    border-right: 2px solid #cbd5e1;
    border-radius: 0 5px 0 0;
}

.org-tree li:first-child::after {
    border-radius: 5px 0 0 0;
}

/* Downward connector from parents */
.org-tree ul ul::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    border-left: 2px solid #cbd5e1;
    width: 0;
    height: 20px;
}

/* Org Chart Card Styling */
.org-card {
    background: white;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 1rem;
    text-decoration: none;
    color: #666;
    display: inline-block;
    min-width: 180px;
    box-shadow: var(--shadow-soft);
    transition: all 0.2s;
    position: relative;
    z-index: 10;
}

.org-card:hover {
    background: var(--color-accent-blue-soft);
    border-color: var(--color-accent-blue);
    transform: translateY(-3px);
    box-shadow: var(--shadow-card);
    color: var(--color-primary-main);
}

.org-card img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin-bottom: 0.5rem;
    border: 2px solid white;
    box-shadow: var(--shadow-soft);
}

.org-card .name {
    font-weight: 700;
    color: var(--color-primary-main);
    font-size: 0.9rem;
    display: block;
}

.org-card .role {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    display: block;
}

/* --- ASSISTANT ON NECK STYLE --- */
.assistant-node {
    position: absolute;
    left: 50%;
    /* FIX: Adjusted top to center vertically on the new 150px neck */
    /* Card height ~130px + 20px margin. Neck starts around 150px mark. */
    top: 180px;
    z-index: 20;
    margin-left: 30px;
    /* Increased offset for better separation */
}

/* Horizontal Connector for Assistant */
.assistant-node::before {
    content: '';
    position: absolute;
    top: 50%;
    /* FIX: Precise math for connection: 30px margin + 1px (half border) */
    left: -31px;
    width: 31px;
    height: 2px;
    background: #cbd5e1;
}

.org-card.assistant {
    min-width: 140px;
    padding: 0.5rem;
    border: 1px dashed var(--color-accent-blue);
    background-color: #f8fafc;
}

.org-card.assistant img {
    width: 36px;
    height: 36px;
    margin-bottom: 0.25rem;
}

.org-card.assistant .name {
    font-size: 0.8rem;
}

.org-card.assistant .role {
    font-size: 0.7rem;
}

/* --- C3 Charts Customization --- */
.c3-chart-arcs-title {
    fill: var(--color-primary-main) !important;
    font-weight: 700;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.c3-axis text {
    font-family: 'Plus Jakarta Sans', sans-serif;
    fill: var(--color-text-muted);
}

.c3-legend-item text {
    font-family: 'Plus Jakarta Sans', sans-serif;
    fill: var(--color-text-main) !important;
}

/* --- PLUGINS --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

.sidebar-trigger {
    padding: 8px;
    border-radius: 8px;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: background 0.2s;
}

.sidebar-trigger:hover {
    background-color: var(--color-bg-app);
    color: var(--color-primary-main);
}

.grid-demo-col {
    background-color: var(--color-accent-blue-soft);
    border: 1px dashed var(--color-accent-blue);
    color: var(--color-accent-blue);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    font-weight: 500;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* DataTables, Select2, Flatpickr, WYSIWYG overrides maintained... */
.dataTables_wrapper .dataTables_length select {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 4px 24px 4px 12px;
    color: var(--color-text-main);
}

.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px 12px;
    margin-left: 8px;
    transition: all 0.2s;
}

.dataTables_wrapper .dataTables_filter input:focus {
    outline: none;
    border-color: var(--color-accent-blue);
    box-shadow: 0 0 0 3px var(--color-accent-blue-soft);
}

.page-item .page-link {
    border: none;
    border-radius: 8px;
    margin: 0 3px;
    color: var(--color-text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 6px 12px;
}

.page-item.active .page-link {
    background-color: var(--color-accent-blue);
    color: white;
}

.page-item.disabled .page-link {
    color: #cbd5e1;
    background-color: transparent;
}

.page-link:hover {
    background-color: var(--color-bg-app);
    color: var(--color-primary-main);
}

/* --- SELECT2 --- */
.select2-container .select2-selection--single {
    height: 46px !important;
    /* MATCHING FORM HEIGHT */
    background-color: var(--color-bg-app);
    border: 1px solid #dee2e6;
    border-radius: 12px;
    display: flex;
    align-items: center;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--color-text-main);
    padding-left: 1rem;
    line-height: normal;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 44px;
    right: 8px;
}

.select2-dropdown {
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    z-index: 9999;
    padding: 5px;
}

.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background-color: var(--color-accent-blue);
    color: white;
    border-radius: 8px;
}

.select2-container--default .select2-results__option--selectable {
    border-radius: 8px;
    margin-bottom: 2px;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 6px;
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
    outline: none;
    border-color: var(--color-accent-blue);
    box-shadow: 0 0 0 3px var(--color-accent-blue-soft);
}

.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: var(--color-accent-blue);
    box-shadow: 0 0 0 3px var(--color-accent-blue-soft);
}

/* --- FLATPICKR --- */
.flatpickr-calendar {
    border-radius: 12px;
    box-shadow: var(--shadow-popover);
    border: 1px solid var(--border-subtle);
}

.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: var(--color-accent-blue);
    border-color: var(--color-accent-blue);
}

.flatpickr-time input:hover,
.flatpickr-time input:focus {
    background: var(--color-bg-app);
}

/* --- WYSIWYG --- */
.ql-toolbar.ql-snow {
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    border-color: #dee2e6;
    background-color: var(--color-bg-app);
}

.ql-container.ql-snow {
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    border-color: #dee2e6;
    background-color: white;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.95rem;
    height: 150px;
}

.form-check-input:checked {
    background-color: var(--color-accent-blue);
    border-color: var(--color-accent-blue);
}

/* --- CUSTOM FILE INPUT --- */
.custom-file-upload {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border: 2px dashed var(--border-subtle);
    border-radius: 16px;
    background-color: var(--color-bg-app);
    transition: all 0.2s ease;
    cursor: pointer;
    text-align: center;
}


/* --- MOBILE RESPONSIVE STYLES --- */
@media (max-width: 768px) {

    /* (Existing mobile styles retained) */
    .app-container {
        flex-direction: column;
        height: 100vh;
        overflow: hidden;
    }

    .rail-nav {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        width: 260px;
        transform: translateX(-100%);
        border-right: 1px solid var(--border-subtle);
        align-items: flex-start;
        padding: 2rem 1rem;
        z-index: 2000;
    }

    .rail-nav.mobile-open {
        transform: translateX(0);
    }

    .rail-nav .logo-area {
        justify-content: space-between;
        padding-left: 10px;
        padding-right: 10px;
    }

    .logo-sm {
        display: none;
    }

    .logo-lg {
        display: block !important;
    }

    .rail-link {
        width: 100%;
        justify-content: flex-start;
        padding-left: 15px;
        height: 48px;
        font-size: 1rem;
    }

    .rail-link i {
        margin-right: 15px;
        width: 24px;
        text-align: center;
    }

    .rail-link.active::after {
        display: none;
    }

    .rail-link.active {
        background-color: var(--color-accent-blue-soft);
        color: var(--color-accent-blue);
    }

    .mobile-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1900;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s;
        backdrop-filter: blur(2px);
    }

    .mobile-overlay.show {
        opacity: 1;
        visibility: visible;
    }

    .master-pane {
        width: 100%;
        position: absolute;
        inset: 0;
        border-right: none;
        z-index: 10;
    }

    .master-pane.hidden {
        display: none;
    }

    .detail-pane {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: white;
        z-index: 50;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        padding: 1rem;
    }

    .detail-pane.show-mobile {
        transform: translateX(0);
    }

    .dropend {
        width: 100%;
        display: block;
    }

    .rail-dropdown-menu {
        position: static !important;
        transform: none !important;
        box-shadow: none;
        padding-left: 3rem;
        width: 100%;
        margin: 0 !important;
        display: none;
        opacity: 1;
        visibility: visible;
    }

    .dropend .rail-link[aria-expanded="true"]+.rail-dropdown-menu {
        display: block;
    }

    .rail-dropdown-menu::before {
        display: none;
    }

    .mobile-back-btn {
        display: inline-flex !important;
        margin-bottom: 1rem;
        align-items: center;
        color: var(--color-text-muted);
        text-decoration: none;
        font-weight: 600;
    }
}

.mobile-back-btn {
    display: none;
}

.mobile-overlay {
    display: none;
}

/* Login Page Styles */
.login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(45deg, rgba(48, 142, 135, 0.12) 20.35%, rgba(243, 145, 89, 0.1) 50%, rgba(2, 162, 185, 0.12) 100%);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
}