/* Modern UI Design System for Planète Production Cotations - Official Graphic Charter */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800;900&family=Nunito:wght@300;400;500;600;700;800&family=Open+Sans:wght@400;600;700&display=swap');

:root {
    /* Official Planète Production Brand Palette */
    --color-production: #c2a36a;     /* Ochre Gold - Production signature color */
    --color-production-hover: #ab8c53;
    --color-production-light: #dfc79b;
    --color-agence: #f2e9cc;         /* Sand / Soft Cream - L'Agence signature */
    --color-externalisation: #a29c82; /* Sage / Taupe - Externalisation signature */
    --color-charcoal: #2c302e;       /* Deep warm charcoal from official logo text */

    /* Semantic UI Tokens (Dark Theme by default) */
    --bg-primary: #17191a;           /* Luxury warm charcoal slate */
    --bg-secondary: #212527;         /* Elevated sidebar & card surface */
    --bg-card: rgba(33, 37, 39, 0.82);
    --bg-card-hover: rgba(45, 51, 54, 0.9);
    --border-color: rgba(194, 163, 106, 0.18);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --text-main: #fbf9f5;
    --text-muted: #a6a096;

    /* Accents mapped to official charter */
    --accent-gold: #c2a36a;
    --accent-blue: #c2a36a;          /* Replaced generic cold blue with Planète Gold */
    --accent-blue-hover: #ab8c53;
    --accent-cyan: #d8be8d;          /* Soft gold tint for highlights */
    --accent-purple: #9d8b70;        /* Warm bronze/taupe */
    --accent-emerald: #2e7d32;       /* Forest green for confirmed/reserved */
    --accent-amber: #d97706;         /* Warm amber for options & relances */
    --accent-rose: #c53030;          /* Brick terracotta for cancellations */
    --accent-sage: #a29c82;

    --sidebar-width: 260px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-glow: 0 0 20px rgba(194, 163, 106, 0.22);
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.35);

    /* Emil Kowalski Design Engineering Easing Curves */
    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
    --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
    --transition: all 0.2s var(--ease-out);
}

/* Light Theme Overrides */
[data-theme="light"] {
    --bg-primary: #faf8f5;           /* Warm ivory / linen */
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f5f1e8;
    --border-color: #e5ded2;
    --border-subtle: #eee9df;
    --text-main: #2a2d2e;
    --text-muted: #6b665e;
    --accent-cyan: #a3844a;
    --shadow-card: 0 4px 18px rgba(194, 163, 106, 0.10);
}

[data-theme="light"] .sidebar {
    background-color: #ffffff;
    border-right-color: #e5ded2;
}

[data-theme="light"] .top-header {
    background: rgba(255, 255, 255, 0.95);
    border-bottom-color: #e5ded2;
}

[data-theme="light"] .custom-table th {
    background: #f7f4ee;
    color: #4a463f;
    border-bottom-color: #dcd4c6;
}

[data-theme="light"] .custom-table td {
    border-bottom-color: #f2ede3;
}

[data-theme="light"] .form-control, [data-theme="light"] .form-select {
    background: #ffffff;
    border-color: #dcd4c6;
    color: #2a2d2e;
}

[data-theme="light"] .modal-container {
    background: #ffffff;
    border-color: #dcd4c6;
}

/* Light Theme Badge Contrast Adjustments */
[data-theme="light"] .badge-reserved {
    color: #1b5e20;
    background: rgba(46, 125, 50, 0.12);
    border-color: rgba(46, 125, 50, 0.35);
}

[data-theme="light"] .badge-option {
    color: #92400e;
    background: rgba(217, 119, 6, 0.14);
    border-color: rgba(217, 119, 6, 0.35);
}

[data-theme="light"] .badge-processed {
    color: #7d6537;
    background: rgba(194, 163, 106, 0.16);
    border-color: rgba(194, 163, 106, 0.4);
}

[data-theme="light"] .badge-refused {
    color: #991b1b;
    background: rgba(197, 48, 48, 0.12);
    border-color: rgba(197, 48, 48, 0.35);
}

[data-theme="light"] .badge-pending {
    color: #5c5545;
    background: rgba(162, 156, 130, 0.2);
    border-color: rgba(162, 156, 130, 0.45);
}

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

body {
    font-family: 'Nunito', 'Open Sans', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .brand-title, .brand-subtitle, .modal-title, .kpi-label, th {
    font-family: 'Montserrat', sans-serif;
}

/* Sidebar Styling & Collapse/Hide Animation */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    overflow: hidden;
    transition: width 0.28s cubic-bezier(0.16, 1, 0.3, 1), transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.28s ease;
    will-change: width, transform;
}

.sidebar-collapse-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s var(--ease-out);
    flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
    background: rgba(194, 163, 106, 0.14);
    color: var(--color-production);
    border-color: rgba(194, 163, 106, 0.25);
    transform: scale(1.06);
}

.sidebar-collapse-btn:active {
    transform: scale(0.94);
}

.sidebar-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    cursor: pointer;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    transition: all 0.2s var(--ease-out);
}

.sidebar-toggle-btn:hover {
    color: var(--color-production);
    border-color: var(--color-production);
    background: rgba(194, 163, 106, 0.12);
    transform: scale(1.04);
}

.sidebar-toggle-btn:active {
    transform: scale(0.96);
}

.sidebar-header {
    padding: 20px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(180deg, rgba(194, 163, 106, 0.08) 0%, transparent 100%);
}

.brand-logo-img {
    width: 46px;
    height: 46px;
    object-fit: contain;
    border-radius: 50%;
    box-shadow: 0 4px 14px rgba(194, 163, 106, 0.3);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.brand-logo-img:hover {
    transform: scale(1.06);
}

.brand-title {
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--text-main);
    letter-spacing: 0.08em;
    line-height: 1.1;
}

.brand-subtitle {
    font-size: 0.72rem;
    color: var(--color-production);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    line-height: 1.2;
    margin-top: 1px;
}

.brand-dots {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
}

.brand-dots .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    transition: transform 0.2s ease;
}

.brand-dots .dot:hover {
    transform: scale(1.4);
}

.brand-dots .dot-prod {
    background-color: var(--color-production);
}

.brand-dots .dot-agence {
    background-color: var(--color-agence);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.brand-dots .dot-ext {
    background-color: var(--color-externalisation);
}

.sidebar-menu {
    list-style: none;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-grow: 1;
}

.sidebar-menu label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    padding: 12px 12px 6px 12px;
    font-weight: 700;
}

.menu-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.menu-item a:hover {
    color: var(--text-main);
    background-color: rgba(194, 163, 106, 0.1);
}

.menu-item.active a {
    color: #ffffff;
    background: linear-gradient(90deg, rgba(194, 163, 106, 0.25), rgba(194, 163, 106, 0.08));
    border-left: 3px solid var(--color-production);
}

[data-theme="light"] .menu-item.active a {
    color: #2a2d2e;
    background: linear-gradient(90deg, rgba(194, 163, 106, 0.22), rgba(194, 163, 106, 0.05));
    border-left: 3px solid var(--color-production);
}

/* Main Content Layout & Transitions */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
    max-width: calc(100% - var(--sidebar-width));
    overflow-x: hidden;
    transition: margin-left 0.28s cubic-bezier(0.16, 1, 0.3, 1), width 0.28s cubic-bezier(0.16, 1, 0.3, 1), max-width 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: margin-left, width;
}

/* ─── Sidebar Collapsed (Icon-Only) Mode ─────────────────────────────────── */
:root { --sidebar-collapsed-width: 64px; }

.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

.sidebar-collapsed .main-wrapper {
    margin-left: var(--sidebar-collapsed-width) !important;
    width: calc(100% - var(--sidebar-collapsed-width)) !important;
    max-width: calc(100% - var(--sidebar-collapsed-width)) !important;
}

/* Hide text labels & section headers when collapsed */
.sidebar-collapsed .sidebar .brand-title,
.sidebar-collapsed .sidebar .brand-subtitle,
.sidebar-collapsed .sidebar .brand-dots,
.sidebar-collapsed .sidebar .menu-item a span,
.sidebar-collapsed .sidebar-menu label {
    opacity: 0;
    width: 0;
    overflow: hidden;
    white-space: nowrap;
    pointer-events: none;
    transition: opacity 0.18s ease, width 0.18s ease;
}

/* Center icons when collapsed */
.sidebar-collapsed .sidebar .menu-item a {
    justify-content: center;
    padding: 10px 0;
    position: relative;
}

.sidebar-collapsed .sidebar .sidebar-header {
    justify-content: center;
    padding: 14px 0;
}

.sidebar-collapsed .sidebar .brand-logo-img {
    margin: 0 auto;
}

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

/* Collapse button flip when collapsed */
.sidebar-collapsed #sidebarCollapseBtn i {
    transform: rotate(180deg);
}

#sidebarCollapseBtn i {
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Tooltip on hover when collapsed */
.sidebar-collapsed .sidebar .menu-item a::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(var(--sidebar-collapsed-width) + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    z-index: 200;
}

.sidebar-collapsed .sidebar .menu-item a:hover::after {
    opacity: 1;
}

/* Mobile Overlay & Responsive Menu */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    }
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    .sidebar-backdrop.active {
        opacity: 1;
        pointer-events: auto;
    }
    .main-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    .top-header {
        padding: 0 16px;
    }
}

.top-header {
    height: 70px;
    padding: 0 30px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
}

.header-title h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Glassmorphism Container & Cards */
.content-body {
    padding: 30px;
    flex-grow: 1;
}

.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

/* KPI Counter Cards Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-blue);
}

.kpi-card.emerald::before { background: var(--accent-emerald); }
.kpi-card.amber::before { background: var(--accent-amber); }
.kpi-card.purple::before { background: var(--accent-purple); }

.kpi-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.03em;
}

.kpi-sub {
    font-size: 0.75rem;
    color: var(--accent-cyan);
}

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

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    animation: toastIn 0.3s ease forwards;
}

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

/* Responsive Rules */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 999;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
    }

    .top-header {
        padding: 0 16px;
    }

    .content-area {
        padding: 16px;
    }

    .mobile-menu-btn {
        display: inline-block !important;
    }
}

@media (max-width: 640px) {
    .brand-pills {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 8px;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .form-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Brand Filter Pills / Tabs */
.brand-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.brand-pill {
    padding: 8px 16px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: transform 160ms var(--ease-out), background-color 160ms ease, color 160ms ease, border-color 160ms ease;
    user-select: none;
}

.brand-pill:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.1);
}

.brand-pill:active {
    transform: scale(0.97);
}

.brand-pill.active {
    background: linear-gradient(135deg, var(--color-production), var(--color-production-hover));
    color: #ffffff;
    border-color: transparent;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(194, 163, 106, 0.35);
}

/* Filter Controls Bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-group .form-control,
.filter-group .form-select {
    width: auto;
    min-width: 140px;
}

.form-control, .form-select {
    box-sizing: border-box;
    background: rgba(23, 25, 26, 0.7);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 9px 14px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out), background-color 160ms ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--color-production);
    box-shadow: 0 0 0 3px rgba(194, 163, 106, 0.2);
}

/* Status Badges */
.badge-status {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.badge-reserved {
    background: rgba(46, 125, 50, 0.16);
    color: #4ade80;
    border: 1px solid rgba(46, 125, 50, 0.35);
}

.badge-option {
    background: rgba(217, 119, 6, 0.16);
    color: #fbbf24;
    border: 1px solid rgba(217, 119, 6, 0.35);
}

.badge-processed {
    background: rgba(194, 163, 106, 0.16);
    color: #dfc79b;
    border: 1px solid rgba(194, 163, 106, 0.35);
}

.badge-refused {
    background: rgba(197, 48, 48, 0.16);
    color: #f87171;
    border: 1px solid rgba(197, 48, 48, 0.35);
}

.badge-pending {
    background: rgba(162, 156, 130, 0.18);
    color: #d1cca8;
    border: 1px solid rgba(162, 156, 130, 0.35);
}

/* Data Table Styling */
.table-responsive {
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

.custom-table th {
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.custom-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    vertical-align: middle;
    white-space: nowrap;
}

.custom-table tbody tr {
    transition: background-color 150ms var(--ease-out);
}

.custom-table tbody tr:hover {
    background: rgba(194, 163, 106, 0.04);
}

/* Buttons */
.btn {
    padding: 9px 18px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 160ms var(--ease-out), background-color 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
    text-decoration: none;
    user-select: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-production), var(--color-production-hover));
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(194, 163, 106, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 18px rgba(194, 163, 106, 0.45);
    transform: translateY(-1px);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(194, 163, 106, 0.15);
    border-color: var(--color-production);
}

.btn-secondary:active {
    transform: scale(0.97);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.78rem;
    border-radius: var(--radius-sm);
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.page-numbers {
    display: flex;
    gap: 6px;
}

.page-link {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8rem;
    transition: transform 160ms var(--ease-out), background-color 160ms ease, color 160ms ease;
    user-select: none;
}

.page-link:hover {
    background: rgba(194, 163, 106, 0.2);
    color: var(--text-main);
}

.page-link:active {
    transform: scale(0.96);
}

.page-link.active {
    background: var(--color-production);
    color: #ffffff;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 220ms ease, visibility 220ms ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 92vw;
    max-width: 780px;
    max-height: 88vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px 28px;
    box-sizing: border-box;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
    transform: scale(0.96) translateY(6px);
    opacity: 0;
    transition: transform 220ms var(--ease-out), opacity 220ms ease-out;
}

.modal-overlay.active .modal-container {
    transform: scale(1) translateY(0);
    opacity: 1;
}

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

.inline-status-select {
    cursor: pointer;
    font-weight: 600;
    border-radius: 20px;
    padding: 4px 10px;
    outline: none;
    transition: var(--transition);
}

.inline-status-select:hover {
    filter: brightness(1.15);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.inline-status-select option {
    background: var(--bg-card);
    color: var(--text-main);
    font-weight: normal;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 700;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 18px;
    width: 100%;
    box-sizing: border-box;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.form-field.full, .form-field-full {
    grid-column: 1 / -1;
    width: 100%;
}

.form-field .form-control,
.form-field .form-select,
.form-field textarea {
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

.form-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* Sticky Header & Frozen First Columns for Data Grid */
.table-responsive {
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    position: relative;
    max-height: calc(100vh - 250px);
}

.custom-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
    text-align: left;
}

.custom-table th {
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    padding: 12px 14px;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

.custom-table th.sticky-col-1,
.custom-table th.sticky-col-2,
.custom-table td.sticky-col-1,
.custom-table td.sticky-col-2 {
    position: sticky;
    z-index: 11;
    background: var(--bg-secondary);
}

.custom-table td.sticky-col-1,
.custom-table td.sticky-col-2 {
    z-index: 5;
}

[data-theme="light"] .custom-table th.sticky-col-1,
[data-theme="light"] .custom-table th.sticky-col-2,
[data-theme="light"] .custom-table td.sticky-col-1,
[data-theme="light"] .custom-table td.sticky-col-2 {
    background: #ffffff;
}

.custom-table th.sticky-col-1,
.custom-table td.sticky-col-1 {
    left: 0;
    width: 40px;
}

.custom-table th.sticky-col-2,
.custom-table td.sticky-col-2 {
    left: 40px;
    box-shadow: 4px 0 8px -2px rgba(0, 0, 0, 0.2);
}

/* Quick Filter Bar for All Tables */
.table-quick-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    margin-bottom: 12px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    backdrop-filter: blur(8px);
    transition: var(--transition);
}

[data-theme="light"] .table-quick-filter-bar {
    background: #f8fafc;
    border-color: #cbd5e1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.quick-filter-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    flex-grow: 1;
    max-width: 480px;
}

.quick-filter-icon {
    color: var(--color-production);
    font-size: 0.9rem;
    margin-left: 2px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.quick-filter-input {
    width: 100% !important;
    padding: 6px 32px 6px 12px !important;
    font-size: 0.84rem !important;
    height: 34px !important;
    border-radius: var(--radius-sm) !important;
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-main) !important;
    transition: all 0.2s var(--ease-out) !important;
}

.quick-filter-input:focus {
    border-color: var(--color-production) !important;
    box-shadow: 0 0 0 3px rgba(194, 163, 106, 0.2) !important;
    outline: none !important;
}

[data-theme="light"] .quick-filter-input {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #1e293b !important;
}

.quick-filter-clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s ease;
}

.quick-filter-clear-btn:hover {
    color: var(--accent-rose);
    background: rgba(197, 48, 48, 0.12);
    transform: translateY(-50%) scale(1.1);
}

.quick-filter-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.quick-filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.76rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(194, 163, 106, 0.12);
    border: 1px solid rgba(194, 163, 106, 0.25);
    color: var(--color-production);
    white-space: nowrap;
}

[data-theme="light"] .quick-filter-badge {
    background: rgba(194, 163, 106, 0.15);
    color: #856124;
}

.quick-filter-badge.filtered {
    background: rgba(16, 185, 129, 0.14);
    border-color: rgba(16, 185, 129, 0.35);
    color: #10b981;
}

[data-theme="light"] .quick-filter-badge.filtered {
    background: rgba(16, 185, 129, 0.15);
    color: #065f46;
}

.quick-filter-shortcut-hint kbd {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: monospace;
}

[data-theme="light"] .quick-filter-shortcut-hint kbd {
    background: #e2e8f0;
    color: #475569;
}

.quick-filter-empty-cell {
    text-align: center;
    padding: 36px 20px !important;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.1);
}

.quick-filter-empty-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.9rem;
}

.quick-filter-empty-content i {
    font-size: 2rem;
    color: var(--color-production);
    opacity: 0.7;
}

/* Detail Side Panel (Slide-Over Drawer) */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 280ms ease, visibility 280ms ease;
}

.drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}

.detail-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 620px;
    max-width: 90vw;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    transform: translateX(100%);
    transition: transform 280ms var(--ease-drawer);
    display: flex;
    flex-direction: column;
}

.detail-drawer.active {
    transform: translateX(0);
}

.drawer-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(15, 23, 42, 0.4);
}

.drawer-body {
    padding: 24px;
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.drawer-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
}

.drawer-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-cyan);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-item.full {
    grid-column: span 2;
}

.detail-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.detail-val {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    word-break: break-word;
}

[data-theme="light"] .detail-drawer {
    background: #ffffff;
    border-left-color: #cbd5e1;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .drawer-header {
    background: #f8fafc;
    border-bottom-color: #cbd5e1;
}

[data-theme="light"] .drawer-section {
    background: #f8fafc;
    border-color: #cbd5e1;
}

/* Emil Kowalski Perceived Performance & Micro-interactions */
.fa-spinner.fa-spin {
    animation-duration: 0.85s !important;
}

/* Snappy Toast notifications */
.toast-alert {
    animation: toastEnter 220ms var(--ease-out) forwards;
}

@keyframes toastEnter {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}



/* Accessible ascending/descending controls keep existing sticky header layout. */
.table-sort-button {
    display: inline-flex;
    align-items: center;
    justify-content: inherit;
    gap: 6px;
    padding: 4px 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
    text-align: inherit;
    cursor: pointer;
}
.table-sort-button:hover { color: var(--accent-cyan); }
.table-sort-button:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 4px; }
.table-sort-indicator { font-size: 0.7rem; opacity: 0.6; }
th[aria-sort="ascending"] .table-sort-indicator,
th[aria-sort="descending"] .table-sort-indicator { opacity: 1; color: var(--accent-cyan); }
