/* Premium Main Stylesheet for Railway Movement Journal */

:root {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --primary: #0f172a;
    --primary-light: #1e293b;
    --accent: #2563eb;
    --accent-light: #eff6ff;
    --accent-hover: #1d4ed8;
    --text-dark: #0f172a;
    --text-light: #f8fafc;
    --text-muted: #64748b;
    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --info: #06b6d4;
    --info-light: #ecfeff;
    --font-sans: 'Outfit', sans-serif;
    
    /* Box shadows & borders */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-dark);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.5;
    overflow-x: hidden;
}

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

/* Sidebar Navigation */
.app-sidebar {
    width: 260px;
    background-color: var(--primary);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 100;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    height: 70px;
    box-sizing: border-box;
}

.brand-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.brand-name {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-pin-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #94a3b8;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-left: auto;
    transition: all 0.2s ease;
}

.sidebar-pin-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    transform: scale(1.05);
}

.sidebar-menu {
    flex: 1;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    overflow-x: hidden;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    color: #94a3b8;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.menu-item:hover {
    color: var(--text-light);
    background-color: rgba(255, 255, 255, 0.03);
}

.menu-item.active {
    color: var(--text-light);
    background-color: var(--accent);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.menu-item.active .menu-icon {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.menu-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #475569;
    margin: 16px 12px 6px 12px;
    letter-spacing: 1px;
    white-space: nowrap;
}

.logout-link:hover {
    background-color: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

.sidebar-footer {
    padding: 20px;
    font-size: 11px;
    color: #475569;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
}

/* Collapsed State on Desktop */
.sidebar-collapsed .app-sidebar {
    width: 72px;
}

.sidebar-collapsed .brand-name,
.sidebar-collapsed .menu-section-label,
.sidebar-collapsed .sidebar-footer,
.sidebar-collapsed .menu-label {
    display: none !important;
}

.sidebar-collapsed .sidebar-brand {
    padding: 20px 10px;
    justify-content: center;
    gap: 0;
}

.sidebar-collapsed .sidebar-pin-btn {
    display: none !important;
}

.sidebar-collapsed .sidebar-menu {
    padding: 20px 8px;
}

.sidebar-collapsed .menu-item {
    justify-content: center;
    padding: 12px 0;
    border-radius: 8px;
}

.sidebar-collapsed .menu-item .menu-icon {
    font-size: 20px;
    margin: 0;
}

/* Main Container Area */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Prevents flex children blowout */
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Top Navbar */
.app-navbar {
    height: 70px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-title {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.sidebar-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    margin-right: 14px;
    color: var(--text-dark);
    transition: all 0.2s ease;
    user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.sidebar-toggle-btn:hover {
    background: #e2e8f0;
    color: var(--accent);
    transform: scale(1.05);
}

.sidebar-overlay {
    display: none;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
}

.user-role {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Content wrapper */
.app-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

/* General Layout Cards */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 30px;
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
}

.card-body {
    padding: 24px;
}

/* Buttons System */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    outline: none;
}

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

.btn-primary:hover {
    background-color: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

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

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

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

.btn-success:hover {
    background-color: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

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

.btn-warning:hover {
    background-color: #d97706;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

.btn-recalc {
    background-color: #0022e6;
    color: white;
}

.btn-recalc:hover {
    background-color: #0019b8;
    box-shadow: 0 4px 12px rgba(0, 34, 230, 0.25);
}

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

.btn-danger:hover {
    background-color: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.ta-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

@media (max-width: 768px) {
    .ta-action-buttons {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Context selector */
.context-selector {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: none;
    color: white;
}

.grid-form-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 20px;
}

.form-group-inline {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 200px;
}

.form-group-inline label {
    font-size: 12px;
    font-weight: 500;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-select, .form-control {
    width: 100%;
    padding: 10px 14px;
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: white;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.form-select option {
    background-color: var(--primary);
    color: white;
}

.form-select:focus, .form-control:focus {
    border-color: var(--accent);
    background-color: rgba(255, 255, 255, 0.12);
}

/* Dashboard Statistics Widgets */
.context-indicator-bar {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 24px;
    font-size: 13px;
    color: var(--text-muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-icon {
    font-size: 32px;
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-primary .stat-icon { background-color: #eff6ff; color: var(--accent); }
.stat-success .stat-icon { background-color: #ecfdf5; color: var(--success); }
.stat-info .stat-icon { background-color: #ecfeff; color: var(--info); }
.stat-warning .stat-icon { background-color: #fffbeb; color: var(--warning); }

.stat-info-wrapper {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
    margin-top: 4px;
}

/* Grid layout columns */
.grid-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

/* Breakdown List Styles */
.breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.breakdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.breakdown-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.bg-movement { background-color: var(--accent); }
.bg-leave { background-color: var(--danger); }
.bg-nh { background-color: var(--warning); }
.bg-rest { background-color: var(--success); }

.breakdown-label {
    flex-grow: 1;
    color: var(--text-muted);
}

.breakdown-value {
    font-weight: 600;
}

.breakdown-item.total {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    margin-top: 8px;
}

.breakdown-item.total .breakdown-label {
    color: var(--text-dark);
    font-weight: 600;
}

/* Quick Action Widgets */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px;
    background-color: var(--accent-light);
    border: 1px solid rgba(37, 99, 235, 0.1);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-dark);
    transition: all 0.2s ease;
}

.action-btn:hover {
    background-color: #dbeafe;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.action-icon {
    font-size: 24px;
}

.action-title {
    font-weight: 600;
    font-size: 14px;
}

.action-desc {
    font-size: 11px;
    color: var(--text-muted);
}

/* Alert Boxes */
.alert-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    font-size: 14px;
}

.alert-success { background-color: var(--success-light); border: 1px solid rgba(16, 185, 129, 0.2); color: #065f46; }
.alert-warning { background-color: var(--warning-light); border: 1px solid rgba(245, 158, 11, 0.2); color: #92400e; }
.alert-error { background-color: var(--danger-light); border: 1px solid rgba(239, 68, 68, 0.2); color: #991b1b; }
.alert-info { background-color: var(--info-light); border: 1px solid rgba(6, 182, 212, 0.2); color: #155e75; }

/* Table Styles */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.table-custom {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table-custom th, .table-custom td {
    padding: 14px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table-custom th {
    background-color: var(--bg-main);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-custom tr:hover td {
    background-color: var(--accent-light);
}

/* Modal Windows */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 600px;
    overflow: hidden;
    animation: zoomIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

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

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

.modal-close {
    font-size: 24px;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.25s ease;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: #ef4444;
    background-color: #f1f5f9;
    transform: rotate(90deg);
}

.modal-body {
    padding: 24px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-main);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1100;
}

.toast {
    padding: 14px 20px;
    background-color: var(--primary);
    color: white;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease forwards;
}

@keyframes slideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-warning { border-left: 4px solid var(--warning); }

/* Custom Forms */
.form-horizontal-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}

.form-group-block label {
    font-size: 13px;
    font-weight: 500;
    color: var(--primary-light);
}

.input-field {
    width: 100%;
    padding: 10px 14px;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    color: var(--text-dark);
}

.input-field:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.select-field {
    width: 100%;
    padding: 10px 14px;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    color: var(--text-dark);
    cursor: pointer;
}

.select-field:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.select-field option {
    background-color: white;
    color: var(--text-dark);
}

/* Compact Forms & Modals Layouts */
.input-field-compact {
    width: 100%;
    padding: 8px 12px;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
    color: var(--text-dark);
}

.input-field-compact:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.select-field-compact {
    width: 100%;
    padding: 8px 12px;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
    color: var(--text-dark);
    cursor: pointer;
}

.select-field-compact:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.select-field-compact option {
    background-color: white;
    color: var(--text-dark);
}

.modal-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

/* Badge styles */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
}

.badge-primary { background-color: var(--accent-light); color: var(--accent); }
.badge-success { background-color: var(--success-light); color: var(--success); }
.badge-warning { background-color: var(--warning-light); color: var(--warning); }
.badge-danger { background-color: var(--danger-light); color: var(--danger); }

/* responsive layout adjustments */
@media (max-width: 1024px) {
    .grid-layout {
        grid-template-columns: 1fr;
    }
}

/* Custom Searchable Autocomplete Suggestions Dropdown */
.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    margin-top: 4px;
}

.autocomplete-suggestion {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-dark);
    transition: background 0.15s ease, color 0.15s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.autocomplete-suggestion:last-child {
    border-bottom: none;
}

.autocomplete-suggestion:hover {
    background-color: var(--accent);
    color: white;
}

/* Joined Search Input Group */
.search-input-group {
    display: flex;
    align-items: stretch;
    width: 100%;
    max-width: 320px;
}

.search-input-group .input-field {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    margin-bottom: 0 !important;
    flex: 1;
}

.search-input-group .btn-search {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    margin: 0 !important;
    padding: 0 16px;
    background-color: var(--accent);
    color: white;
    border: 1px solid var(--accent);
    border-left: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.search-input-group .btn-search:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
}

/* Action Buttons Group (flex on desktop, stacked on mobile) */
.action-buttons-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Responsive adjustments for Mobile/Tablet */
@media (max-width: 768px) {
    /* Layout */
    .app-container {
        flex-direction: column;
    }
    
    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 260px;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.2);
        z-index: 1050;
    }
    
    .app-sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-footer, .menu-section-label {
        display: none;
    }
    
    .app-navbar {
        padding: 0 16px;
        padding-left: max(18px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }

    .navbar-title {
        font-size: 16px !important;
        font-weight: 700 !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .user-info {
        display: none !important;
    }
    
    .sidebar-toggle-btn {
        display: inline-flex !important;
        width: 46px;
        height: 46px;
        min-width: 46px;
        min-height: 46px;
        font-size: 21px;
        margin-right: 12px;
    }

    .sidebar-pin-btn {
        width: 38px;
        height: 38px;
        min-width: 38px;
        min-height: 38px;
        font-size: 20px;
    }
    
    .sidebar-overlay.active {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.45);
        backdrop-filter: blur(2px);
        z-index: 1040;
    }
    
    .app-content {
        padding: 15px;
    }
    
    /* Card headers responsive wrapping */
    .card-header {
        flex-direction: column;
        align-items: stretch !important;
        gap: 12px;
        padding: 15px;
    }
    
    .card-header > div {
        flex-direction: column;
        align-items: stretch !important;
        width: 100%;
        gap: 8px !important;
    }
    
    .card-header input, .card-header select, .card-header button {
        width: 100% !important;
        margin: 0 !important;
    }
    
    /* Table to Card conversion for Daily Movements */
    #sheet_table, #sheet_table thead, #sheet_table tbody, #sheet_table th, #sheet_table td, #sheet_table tr {
        display: block;
    }
    
    #sheet_table thead {
        display: none; /* Hide standard headers */
    }
    
    #sheet_body tr {
        margin-bottom: 20px;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        background-color: var(--bg-card);
        padding: 15px;
        box-shadow: var(--shadow-sm);
    }
    
    #sheet_body td {
        border: none;
        padding: 8px 0;
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        width: 100% !important;
    }
    
    #sheet_body td::before {
        content: attr(data-label);
        font-weight: 700;
        font-size: 11px;
        text-transform: uppercase;
        color: var(--text-muted);
        margin-bottom: 5px;
        display: block;
        font-family: var(--font-sans);
    }
    
    /* Autocomplete dropdown positioning on mobile */
    .autocomplete-suggestions {
        position: absolute;
        width: 100%;
        box-shadow: var(--shadow-lg);
        z-index: 1000;
    }

    /* Mobile Sidebar overlay activation */
    .app-sidebar.open ~ .sidebar-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background-color: rgba(15, 23, 42, 0.4);
        backdrop-filter: blur(4px);
        z-index: 1040;
    }

    /* Grid Layouts Stacked on Mobile */
    .grid-layout {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    .quick-actions-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .context-indicator-bar {
        flex-wrap: wrap;
        gap: 8px 12px;
    }

    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    /* Modal dialog responsive sizing */
    .modal-content {
        margin: 15px;
        max-width: calc(100% - 30px);
    }

    /* Inline forms responsive wrapping */
    .grid-form-inline {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .form-group-inline {
        width: 100%;
    }

    /* Form horizontal group stacking on mobile */
    .form-horizontal-group {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        margin-bottom: 12px !important;
    }

    /* Stack daily movements leg modal grid vertically on mobile */
    .modal-grid-2col {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    /* Scale up compact inputs for better touch target size on mobile */
    .input-field-compact, .select-field-compact {
        padding: 10px 14px !important;
        font-size: 14px !important;
    }

    /* Responsive modal adjustments */
    .modal-content {
        margin: 0 auto !important;
        max-width: 100% !important;
        border-radius: 10px !important;
    }

    .modal-header {
        padding: 12px 16px !important;
    }

    .modal-title {
        font-size: 15px !important;
        line-height: 1.3 !important;
        padding-right: 24px !important; /* Avoid overlapping the close button */
    }

    .modal-body {
        padding: 12px 16px !important;
    }

    .modal-body .form-group-block {
        margin-bottom: 8px !important;
        gap: 4px !important;
    }

    .modal-body .form-horizontal-group {
        gap: 8px !important;
        margin-bottom: 8px !important;
    }

    .modal-body .leg-row-item.card .card-body {
        padding: 10px !important;
    }

    .modal-footer {
        padding: 10px 16px !important;
        gap: 8px !important;
    }

    /* Search input group mobile wrapping */
    .filter-form-custom {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    
    .search-input-group {
        max-width: 100% !important;
        flex: 1 1 auto !important;
    }

    /* Action buttons group mobile stacking */
    .action-buttons-group {
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        gap: 8px !important;
    }
    
    .action-buttons-group .btn {
        width: 100% !important;
        text-align: center !important;
        justify-content: center !important;
    }
}

