/* =============== UJEDNAČENI CSS ZA DASHBOARD APLIKACIJU =============== */

:root {
    --bg: #0e1320;
    --panel: #121a2b;
    --panel-2: #0f172a;
    --text: #e6ecff;
    --muted: #a9b3d1;
    --accent: #5b8cff;
    --accent-2: #22c55e;
    --accent-3: #ef4444;
    --accent-4: #f59e0b;
    --card: #111827;
    --card-soft: #0f172a;
    --border: #263044;
    --surface: #18253d;
    --surface-2: #1e3052;
    --input-border: #2e4a6b;
    --shadow: 0 8px 30px rgba(0,0,0,.35);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 60px;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    font-family: Inter, "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    background: linear-gradient(180deg, #0a0f1c 0%, #0e1320 100%);
    color: var(--text);
}

/* =============== LAYOUT SA COLLAPSIBLE SIDEBAR =============== */

.layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
    transition: all 0.3s ease;
}

.sidebar {
    width: var(--sidebar-width);
    background: #0b1120;
    border-right: 1px solid var(--border);
    padding: 18px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    transition: all 0.3s ease;
    overflow: hidden;
    z-index: 100;
}

    .sidebar.collapsed {
        width: var(--sidebar-collapsed-width);
        padding: 18px 8px;
    }

.sidebar-toggle {
    position: absolute;
    top: 18px;
    right: -15px;
    width: 30px;
    height: 30px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--muted);
    transition: all 0.2s ease;
    z-index: 101;
}

    .sidebar-toggle:hover {
        background: var(--accent);
        color: white;
        transform: scale(1.1);
    }

.sidebar.collapsed .sidebar-toggle {
    transform: rotate(180deg);
}

.brand {
    font-weight: 800;
    letter-spacing: .4px;
    margin-bottom: 24px;
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .brand {
    opacity: 0;
}

.nav-item {
    color: #cbd5e1;
    text-decoration: none;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
    transition: all 0.2s ease;
    position: relative;
}

    .nav-item::before {
        content: '';
        width: 18px;
        height: 18px;
        flex-shrink: 0;
        opacity: 0.7;
        font-size: 16px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: normal;
        font-family: Arial, sans-serif;
    }

   
/* ALTERNATIVA: Jednostavni grafički simboli */
/*
.nav-item:nth-child(1)::before { content: '▣'; color: #5b8cff; }
.nav-item:nth-child(2)::before { content: '✎'; color: #22c55e; }
.nav-item:nth-child(3)::before { content: '⟲'; color: #f59e0b; }
.nav-item:nth-child(4)::before { content: '⌘'; color: #ef4444; }
.nav-item:nth-child(5)::before { content: '⚙'; color: #8b5cf6; }
.nav-item:nth-child(6)::before { content: '⚡'; color: #06b6d4; }
.nav-item:nth-child(7)::before { content: '▲'; color: #10b981; }
*/

.sidebar.collapsed .nav-item {
    padding: 12px 8px;
    justify-content: center;
}

    .sidebar.collapsed .nav-item span {
        display: none;
    }

.nav-item:hover {
    background: #0f172a;
    border-color: #1f2a44;
    color: #fff;
}

    .nav-item:hover::before {
        opacity: 1;
    }

.nav-item.active {
    background: #172033;
    border-color: #2a3856;
    color: #e6ecff;
}

    .nav-item.active::before {
        opacity: 1;
    }

/* =============== COLLAPSIBLE SECTIONS U SIDEBAR-U =============== */

.nav-section {
    margin-bottom: 16px;
}

.nav-section-header {
    color: #64748b;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 16px 4px 16px;
    margin-bottom: 4px;
    border-bottom: 1px solid #1e293b;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: all 0.2s ease;
}

.nav-section-header:hover {
    color: #e6ecff;
}

.nav-section .nav-item {
    margin-bottom: 2px;
    font-size: 13px;
}

.sidebar.collapsed .nav-section-header {
    display: none;
}

.collapse-icon {
    font-size: 12px;
    transition: transform 0.2s ease;
}

.nav-section.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.nav-section-content {
    transition: all 0.3s ease;
    overflow: hidden;
}

.nav-section.collapsed .nav-section-content {
    display: none;
}

.nav-section:not(.collapsed) .nav-section-content {
    display: block;
}

/* Tooltip za collapsed sidebar */
.sidebar.collapsed .nav-item:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 10px;
    padding: 8px 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 13px;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: 100%;
    overflow-x: auto;
}

/* =============== HEADER SA USER INFO =============== */

.header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(15,22,39,.8);
    backdrop-filter: blur(12px);
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .header h1 {
        margin: 0;
        font-weight: 700;
        letter-spacing: .3px;
        font-size: 24px;
    }

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

.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
}

    .mobile-menu-btn:hover {
        background: var(--accent);
        border-color: var(--accent);
    }

/* =============== CONTENT (FULL WIDTH) =============== */

.content, .main-content {
    padding: 22px;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    /* flex: 1 omogućava da sadržaj zauzme preostali prostor pored sidebar-a */
}

/* =============== KPI CARDS (UNIFIKOVAN STIL) =============== */

.kpi-grid, .plan-kpi-grid {
    display: grid;
    gap: 14px;
    margin-bottom: 24px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.kpi-card, .plan-kpi-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    box-shadow: var(--shadow);
    min-width: 0;
    text-align: center;
    transition: transform 0.2s ease;
}

    .kpi-card:hover, .plan-kpi-card:hover {
        transform: translateY(-2px);
    }

    .kpi-card span, .plan-kpi-card .kpi-label {
        display: block;
        font-size: 11px;
        color: var(--muted);
        margin-bottom: 8px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .kpi-card strong, .plan-kpi-card .kpi-value {
        font-size: 24px;
        font-weight: 700;
        color: var(--text);
        line-height: 1;
    }

/* KPI status colors */
#kpiQualityCard.ok {
    outline: 2px solid rgba(34,197,94,.3);
}

#kpiQualityCard.warn {
    outline: 2px solid rgba(245,158,11,.35);
}

#kpiQualityCard.danger {
    outline: 2px solid rgba(239,68,68,.35);
}

.plan-kpi-card.total-coils .kpi-value {
    color: var(--accent);
}

.plan-kpi-card.total-weight .kpi-value {
    color: var(--accent-2);
}

.plan-kpi-card.total-painting .kpi-value {
    color: var(--accent-4);
}

.plan-kpi-card.total-washing .kpi-value {
    color: var(--accent-4);
}

/* =============== SEARCH AND ACTIONS (PLAN-EDITOR STIL) =============== */

.search-horizontal, .actions-horizontal {
    background: rgba(255,255,255,.04);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.search-row, .actions-row-new {
    display: flex;
    gap: 16px;
    align-items: end;
    flex-wrap: wrap;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 120px;
}

    .field-group.col-2 {
        grid-column: span 2;
    }

    .field-group.col-3 {
        grid-column: span 3;
    }

    .field-group.full-width {
        grid-column: 1 / -1;
    }

    .field-group.hidden {
        display: none;
    }

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

    .field-group input, .field-group select, .field-group textarea {
        background: var(--panel-2);
        border: 1px solid var(--border);
        color: var(--text);
        padding: 10px 12px;
        border-radius: 10px;
        outline: none;
        transition: border-color .2s, box-shadow .2s;
        font-size: 13px;
    }

        .field-group input:focus, .field-group select:focus, .field-group textarea:focus {
            border-color: var(--accent);
            box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.1);
        }

    .field-group textarea {
        min-height: 80px;
        resize: vertical;
    }

.search-divider, .actions-divider {
    height: 32px;
    width: 1px;
    background: var(--border);
    margin: 0 8px;
    flex-shrink: 0;
}

.actions-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.actions-group-label {
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .3px;
    margin-right: 8px;
    white-space: nowrap;
}

.button-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* =============== PLAN FORM (PLAN-EDITOR STIL) =============== */

.plan-form {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    margin-bottom: 20px;
    background: rgba(255,255,255,.06);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
}

    .plan-form .field-group {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .plan-form input, .plan-form select, .plan-form textarea {
        background: var(--panel-2);
        border: 1px solid var(--border);
        color: var(--text);
        padding: 10px 12px;
        border-radius: 10px;
        outline: none;
        transition: border-color .2s, box-shadow .2s;
        font-size: 13px;
    }

        .plan-form input:focus, .plan-form select:focus, .plan-form textarea:focus {
            border-color: var(--accent);
            box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.1);
        }

/* Dummy coil styling */
.dummy-coil-mode {
    background: var(--warning-bg) !important;
    border-color: var(--warning) !important;
}

.auto-calculated {
    background: var(--success-bg) !important;
    border-color: var(--success) !important;
}

/* =============== STATUS CARDS (PLAN-EDITOR) =============== */

.status-cards {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.status-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    box-shadow: var(--shadow);
}

    .status-card .card-label {
        display: block;
        font-size: 11px;
        color: var(--muted);
        margin-bottom: 8px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .status-card input, .status-card select {
        background: var(--panel-2);
        border: 1px solid var(--border);
        color: var(--text);
        padding: 8px;
        border-radius: 8px;
        width: 100%;
        box-sizing: border-box;
    }

    .status-card label.checkbox-label {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        cursor: pointer;
        margin-top: 8px;
        text-transform: none;
        letter-spacing: normal;
    }

    .status-card input[type="checkbox"] {
        width: auto;
        margin: 0;
    }

/* =============== BUTTONS (POBOLJŠANI STIL) =============== */

button, .btn-action {
    cursor: pointer;
    user-select: none;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-weight: 600;
    letter-spacing: .2px;
    font-size: 13px;
    transition: all .15s ease;
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

    button:before, .btn-action:before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
        transition: left 0.5s;
    }

    button:hover:before, .btn-action:hover:before {
        left: 100%;
    }

.btn-primary {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #fff;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

    .btn-primary:hover {
        background: linear-gradient(135deg, #4338ca, #5b21b6);
        box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
        transform: translateY(-1px);
    }

.btn-secondary {
    background: linear-gradient(135deg, #475569, #64748b);
    color: #e2e8f0;
    box-shadow: 0 2px 6px rgba(71, 85, 105, 0.2);
}

    .btn-secondary:hover {
        background: linear-gradient(135deg, #334155, #475569);
        box-shadow: 0 3px 10px rgba(71, 85, 105, 0.3);
        transform: translateY(-1px);
    }

.btn-create {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}

    .btn-create:hover {
        background: linear-gradient(135deg, #0284c7, #0369a1);
        box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
        transform: translateY(-1px);
    }

.btn-save {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

    .btn-save:hover {
        background: linear-gradient(135deg, #16a34a, #15803d);
        box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
        transform: translateY(-1px);
    }

.btn-reset {
    background: linear-gradient(135deg, #64748b, #475569);
    color: #e2e8f0;
    box-shadow: 0 2px 6px rgba(100, 116, 139, 0.2);
}

    .btn-reset:hover {
        background: linear-gradient(135deg, #475569, #334155);
        box-shadow: 0 3px 10px rgba(100, 116, 139, 0.3);
        transform: translateY(-1px);
    }

.btn-export, .btn-export-csv {
    background: linear-gradient(135deg, #059669, #047857);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

    .btn-export:hover, .btn-export-csv:hover {
        background: linear-gradient(135deg, #047857, #065f46);
        box-shadow: 0 4px 12px rgba(5, 150, 105, 0.4);
        transform: translateY(-1px);
    }

.btn-export-excel {
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.3);
}

    .btn-export-excel:hover {
        background: linear-gradient(135deg, #15803d, #166534);
        box-shadow: 0 4px 12px rgba(22, 163, 74, 0.4);
        transform: translateY(-1px);
    }

.btn-copy {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

    .btn-copy:hover {
        background: linear-gradient(135deg, #6d28d9, #5b21b6);
        box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
        transform: translateY(-1px);
    }

.btn-paste {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

    .btn-paste:hover {
        background: linear-gradient(135deg, #b91c1c, #991b1b);
        box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
        transform: translateY(-1px);
    }

.btn-compact {
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 6px;
}

/* =============== TABLES (UJEDNAČENO - FULL WIDTH) =============== */

.table-wrapper, .plan-table-wrapper {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 100%;
    overflow-x: auto; /* Dodano za bolje horizontalno skrolovanje */
}

table, .plan-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: auto;
    min-width: 1400px; /* Minimalna širina za plan tabelu */
}

thead th {
    background: linear-gradient(180deg,#172033,#131c2e);
    color: #c9d6ff;
    font-weight: 700;
    font-size: 11px;
    text-align: left;
    padding: 8px 6px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1;
    white-space: nowrap;
}

    thead th[data-sort] {
        cursor: pointer;
    }

        thead th[data-sort]:hover {
            color: #fff;
        }

tbody td {
    padding: 8px 6px;
    border-bottom: 1px solid #1f2a40;
    background: transparent;
    color: var(--text);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

tbody tr:hover td {
    background: rgba(255,255,255,.03);
}

tbody tr.selected td {
    background: rgba(59, 130, 246, 0.2);
}

tbody td[contenteditable="true"] {
    outline: none;
    border-radius: 8px;
}

/* Production table row styles */
#dataTable tbody tr {
    background: rgba(255,255,255,0.02);
}

    #dataTable tbody tr.row-default {
        background: rgba(255,255,255,0.02);
    }

    #dataTable tbody tr.row-yellow {
        background: rgba(255, 214, 10, 0.22) !important;
    }

    #dataTable tbody tr.row-fault {
        background: rgba(220, 38, 38, 0.22) !important;
    }

    #dataTable tbody tr.row-multipass {
        background: rgba(34, 197, 94, 0.18) !important;
    }

    #dataTable tbody tr:hover {
        filter: brightness(1.08);
    }

/* Action buttons */
.action-btn {
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 10px;
    box-shadow: inset 0 -2px 0 rgba(0,0,0,.2);
    margin: 1px;
    white-space: nowrap;
}

.action-edit {
    background: rgba(34,197,94,.18);
    color: #bfffcf;
    border: 1px solid rgba(34,197,94,.35);
}

.action-del {
    background: rgba(239,68,68,.18);
    color: #ffd2d2;
    border: 1px solid rgba(239,68,68,.35);
}

.action-det {
    background: rgba(91,140,255,.18);
    color: #dde8ff;
    border: 1px solid rgba(91,140,255,.35);
}

.action-edit:hover {
    background: rgba(34,197,94,.28);
}

.action-del:hover {
    background: rgba(239,68,68,.28);
}

.action-det:hover {
    background: rgba(91,140,255,.28);
}

/* =============== DRAG & DROP (PLAN-EDITOR) =============== */

.plan-table tr.draggable {
    cursor: move;
}

.plan-table tr.dragging {
    opacity: 0.5;
    background: rgba(59, 130, 246, 0.3) !important;
}

.plan-table tr.drag-over {
    border-top: 3px solid var(--accent) !important;
}

.drag-handle {
    cursor: move;
    color: var(--muted);
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    transition: all 0.2s;
}

    .drag-handle:hover {
        background: rgba(59, 130, 246, 0.2);
        color: var(--accent);
    }

.move-buttons {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.move-btn {
    padding: 2px 4px;
    font-size: 10px;
    background: var(--panel-2);
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 16px;
}

    .move-btn:hover:not(:disabled) {
        background: var(--accent);
        color: white;
        border-color: var(--accent);
    }

    .move-btn:disabled {
        opacity: 0.3;
        cursor: not-allowed;
    }

/* =============== PLAN ITEMS (PLAN-EDITOR) =============== */

.plan-item {
    background: rgba(255,255,255,.04);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    transition: all 0.2s ease;
}

    .plan-item:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow);
    }

    .plan-item.priority {
        border-color: var(--accent-4);
        background: rgba(245, 158, 11, 0.08);
    }

    .plan-item.dummy-coil {
        border-color: var(--warning);
        background: var(--warning-bg);
    }

.plan-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

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

.plan-item-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    font-size: 12px;
}

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

.meta-label {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
}

.meta-value {
    color: var(--text);
    font-weight: 500;
}

.status-badges {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

    .status-badge.planned {
        background: rgba(91, 140, 255, 0.2);
        color: #dde8ff;
    }

    .status-badge.ready {
        background: rgba(34, 197, 94, 0.2);
        color: #bfffcf;
    }

    .status-badge.partial {
        background: rgba(245, 158, 11, 0.2);
        color: #fef3c7;
    }

    .status-badge.not-ready {
        background: rgba(239, 68, 68, 0.2);
        color: #ffd2d2;
    }

    .status-badge.dummy-coil {
        background: var(--warning-bg);
        color: var(--warning);
    }

/* =============== MODALS (UJEDNAČENO) =============== */

.modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.55);
    z-index: 50;
}

.modal {
    width: min(860px,95vw);
    background: linear-gradient(180deg,#10192c,#0c1322);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px;
    box-shadow: var(--shadow);
    max-height: 90vh;
    overflow-y: auto;
}

    .modal h2 {
        margin: 0 0 12px 0;
    }

#entryForm {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(4, minmax(0,1fr));
}

    #entryForm label {
        display: flex;
        flex-direction: column;
        gap: 6px;
        font-size: 12px;
        color: var(--muted);
    }

    #entryForm input[type="text"],
    #entryForm input[type="number"],
    #entryForm input[type="date"],
    #entryForm textarea,
    #entryForm select {
        background: #0c1426;
        color: var(--text);
        border: 1px solid var(--border);
        padding: 9px 10px;
        border-radius: 10px;
        outline: none;
    }

    #entryForm textarea {
        min-height: 62px;
        grid-column: span 4;
        resize: vertical;
    }

.modal-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 6px;
}

/* Detail modal styles */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

    .detail-grid .field {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

        .detail-grid .field label {
            font-size: 12px;
            opacity: .8;
        }

.detail-row {
    grid-column: 1/-1;
}

.field input, .field select, .field textarea {
    padding: 8px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 8px;
    background: transparent;
    color: inherit;
}

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

/* =============== INFO BOXES =============== */

.dummy-coil-info {
    background: var(--warning-bg);
    border: 1px solid var(--warning);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text);
}

.calculation-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
    font-size: 12px;
    color: var(--text);
}

    .calculation-info h4 {
        margin: 0 0 8px 0;
        color: var(--accent);
        font-size: 13px;
    }

.calculation-formula {
    font-family: monospace;
    background: rgba(0,0,0,0.3);
    padding: 4px 8px;
    border-radius: 4px;
    margin: 4px 0;
}

.reorder-info {
    background: rgba(124, 58, 237, 0.1);
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
    font-size: 12px;
    color: var(--text);
}

    .reorder-info h4 {
        margin: 0 0 8px 0;
        color: #7c3aed;
        font-size: 13px;
    }

.error-box {
    background: #7f1d1d;
    color: #fecaca;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid #991b1b;
}

.success-box {
    background: #064e3b;
    color: #d1fae5;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid #059669;
}

/* =============== CHARTS =============== */

.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 24px 0 16px 0;
    max-width: 100%;
    width: 100%;
}

.chart-card {
    background: rgba(255,255,255,.06);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    min-width: 0;
    overflow: hidden;
    box-shadow: var(--shadow);
}

    .chart-card h3 {
        margin: 0 0 12px 0;
        font-size: 15px;
        font-weight: 600;
        opacity: .9;
        text-align: center;
        color: var(--text);
    }

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
    max-width: 100%;
}

.chart-card canvas {
    max-width: 100% !important;
    height: auto !important;
}

/* =============== PAGINATION =============== */

.pagination {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    margin: 12px 4px 0;
}

    .pagination button {
        background: #1f2a44;
        color: #d5defa;
    }

    .pagination select {
        background: var(--panel-2);
        border: 1px solid var(--border);
        color: var(--text);
        padding: 6px 10px;
        border-radius: 10px;
    }

/* =============== LOADING SPINNER =============== */

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #3b82f6;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* =============== RESPONSIVE DESIGN =============== */

@media (max-width: 1200px) {
    .sidebar {
        position: fixed;
        z-index: 1000;
        transform: translateX(-100%);
        height: 100vh;
        box-shadow: var(--shadow);
    }

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

    .mobile-menu-btn {
        display: flex;
    }

    .main {
        width: 100%;
    }

    .plan-form {
        grid-template-columns: repeat(4, 1fr);
    }

    .status-cards {
        grid-template-columns: repeat(3, 1fr);
    }

    .kpi-grid, .plan-kpi-grid {
        grid-template-columns: repeat(4, minmax(0,1fr));
    }

    .charts-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .chart-container {
        height: 250px;
    }
}

@media (max-width: 768px) {
    .search-row, .actions-row-new {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .search-divider, .actions-divider {
        height: 1px;
        width: 100%;
        margin: 8px 0;
    }

    .button-group {
        justify-content: center;
    }

    .field-group {
        min-width: unset;
    }

    .plan-form {
        grid-template-columns: repeat(2, 1fr);
    }

    .status-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .kpi-grid, .plan-kpi-grid {
        grid-template-columns: repeat(2, minmax(0,1fr));
    }

    #entryForm {
        grid-template-columns: repeat(2, minmax(0,1fr));
    }
}

@media (max-width: 640px) {
    .content {
        padding: 12px;
    }

    .header {
        padding: 12px 16px;
    }

        .header h1 {
            font-size: 18px;
        }

    .plan-form {
        grid-template-columns: 1fr;
        padding: 16px;
    }

    .status-cards {
        grid-template-columns: 1fr;
    }

    .kpi-grid, .plan-kpi-grid {
        grid-template-columns: 1fr;
    }

    #entryForm {
        grid-template-columns: 1fr;
    }

    .table-wrapper, .plan-table-wrapper {
        overflow-x: auto;
        border-radius: 8px; /* Manji border-radius na mobile */
    }

    table, .plan-table {
        min-width: 1200px; /* Smanjena minimalna širina za mobile */
    }

    tbody td {
        font-size: 11px;
        padding: 6px 4px;
    }

    thead th {
        font-size: 10px;
        padding: 8px 4px;
    }

    .btn-action {
        padding: 8px 12px;
        font-size: 12px;
    }

    .btn-compact {
        padding: 6px 10px;
        font-size: 11px;
    }

    .chart-card {
        padding: 12px;
    }

    .chart-container {
        height: 220px;
    }

    /* Posebno za plan tabelu na mobile */
    .plan-table th,
    .plan-table td {
        min-width: 80px;
        font-size: 10px;
        padding: 4px 2px;
    }

        .plan-table th:first-child,
        .plan-table td:first-child {
            min-width: 30px;
        }
}

/* =============== SIDEBAR OVERLAY ZA MOBILE =============== */

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: none;
}

    .sidebar-overlay.show {
        display: block;
    }

@media (min-width: 1201px) {
    .mobile-menu-btn {
        display: none;
    }

    .sidebar-overlay {
        display: none !important;
    }
}

/* =============== UTILITY CLASSES =============== */

.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--muted);
}

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: 8px;
}

.mb-2 {
    margin-bottom: 16px;
}

.mb-3 {
    margin-bottom: 24px;
}

.mt-0 {
    margin-top: 0;
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 16px;
}

.mt-3 {
    margin-top: 24px;
}

.p-0 {
    padding: 0;
}

.p-1 {
    padding: 8px;
}

.p-2 {
    padding: 16px;
}

.p-3 {
    padding: 24px;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 {
    gap: 8px;
}

.gap-2 {
    gap: 16px;
}

.gap-3 {
    gap: 24px;
}

.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}

/* =============== ANIMATIONS =============== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.animate-slide-in {
    animation: slideIn 0.3s ease-out;
}

/* =============== ACCESSIBILITY =============== */

button:focus-visible,
.btn-action:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* =============== PRINT STYLES =============== */

@media print {
    .sidebar,
    .header-controls,
    .actions-horizontal,
    .search-horizontal,
    .pagination,
    .sidebar-toggle,
    .mobile-menu-btn {
        display: none !important;
    }

    .layout {
        display: block;
    }

    .main {
        margin: 0;
        padding: 0;
    }

    .content {
        padding: 20px;
        max-width: none;
    }

    body {
        background: white;
        color: black;
    }

    .table-wrapper,
    .plan-table-wrapper {
        box-shadow: none;
        border: 1px solid #000;
    }

    thead th {
        background: #f0f0f0 !important;
        color: #000 !important;
    }

    tbody td {
        color: #000 !important;
        border-bottom: 1px solid #ddd !important;
    }
}
/* Auto-complete stilovi za boje - DODAJTE NA KRAJ unified-styles.css */

.autocomplete-container {
    position: relative;
    display: block;
    width: 100%;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--panel);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.autocomplete-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 14px;
    transition: background-color 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

    .autocomplete-item:hover,
    .autocomplete-item.selected {
        background-color: var(--accent);
        color: white;
    }

    .autocomplete-item:last-child {
        border-bottom: none;
        border-radius: 0 0 8px 8px;
    }

/* Indikator za autocomplete polja */
.autocomplete-container input {
    position: relative;
}

    .autocomplete-container input:focus {
        border-color: var(--accent);
    }

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .autocomplete-list {
        background: var(--panel-2);
        border-color: var(--border);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }

    .autocomplete-item {
        color: var(--text);
        border-bottom-color: var(--border);
    }
}

/* Responsivni dizajn */
@media (max-width: 768px) {
    .autocomplete-list {
        max-height: 150px;
    }

    .autocomplete-item {
        padding: 10px 12px;
        font-size: 16px; /* Veći font na mobilnim uređajima */
    }
}

/* Specijalni stilovi za paint polja */
.field-group .autocomplete-container {
    margin-top: 4px;
}

/* Loading indikator (opciono) */
.autocomplete-loading {
    padding: 8px 12px;
    text-align: center;
    color: var(--muted);
    font-style: italic;
}

/* Dodatni stilovi za ZV (Zamena valjaka) podršku */

/* KPI kartica za ukupno vreme rada */
.plan-kpi-card.total-work-time {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
}

    .plan-kpi-card.total-work-time .kpi-label {
        color: rgba(255, 255, 255, 0.9);
    }

/* Status badge za ZV */
.status-badge.zv-coil {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: white;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
}

/* Plan item za ZV */
.plan-item.special-coil {
    border-left: 4px solid #06b6d4;
}

    .plan-item.special-coil.zv-mode {
        border-left-color: #0891b2;
        background: linear-gradient(135deg, rgba(6, 182, 212, 0.05), rgba(8, 145, 178, 0.05));
    }

/* Form u ZV režimu */
.plan-form.zv-mode {
    border: 2px solid #06b6d4;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.02), rgba(8, 145, 178, 0.02));
}

    .plan-form.zv-mode .field-group label {
        color: #0891b2;
        font-weight: 600;
    }

/* Polje za vreme zamene valjaka */
#rollerReplacementTimeGroup label {
    color: #0891b2;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

#rollerReplacementTime {
    border: 2px solid #06b6d4;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    transition: all 0.2s ease;
    background: rgba(6, 182, 212, 0.05);
}

    #rollerReplacementTime:focus {
        outline: none;
        border-color: #0891b2;
        box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
        background: rgba(6, 182, 212, 0.08);
    }

    #rollerReplacementTime::placeholder {
        color: #64748b;
        font-style: italic;
    }

/* Special coil info za ZV */
.special-coil-info.zv-mode {
    background: linear-gradient(135deg, #e0f2fe, #f0f9ff);
    border-color: #06b6d4;
}

    .special-coil-info.zv-mode h4 {
        color: #0891b2;
    }

/* Tabela - ZV redovi */
.plan-table tr[style*="e8f4fd"] {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1), rgba(8, 145, 178, 0.05)) !important;
}

    .plan-table tr[style*="e8f4fd"]:hover {
        background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(8, 145, 178, 0.1)) !important;
    }

/* ZV specifični elementi u tabeli */
.plan-table td:contains("🔄 zv") {
    font-weight: 700;
    color: #0891b2;
}

/* Responsive stilovi */
@media (max-width: 768px) {
    .plan-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .plan-kpi-card {
        min-height: 80px;
    }

        .plan-kpi-card .kpi-value {
            font-size: 20px;
        }

    .special-coil-info {
        margin-bottom: 16px;
        padding: 12px;
    }

        .special-coil-info h4 {
            font-size: 13px;
        }

        .special-coil-info p {
            font-size: 12px;
            margin-bottom: 0;
        }
}

/* Animacije za smooth transition */
.plan-form {
    transition: all 0.3s ease;
}

.special-coil-info {
    transition: all 0.3s ease;
    transform-origin: top;
}

    .special-coil-info[style*="block"] {
        animation: slideDown 0.3s ease;
    }

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px) scaleY(0.8);
    }

    to {
        opacity: 1;
        transform: translateY(0) scaleY(1);
    }
}

.field-group {
    transition: all 0.2s ease;
}

    .field-group.hidden {
        opacity: 0;
        transform: translateX(-10px);
        pointer-events: none;
    }

/* Poboljšanja za accessibility */
#rollerReplacementTime:focus-visible {
    outline: 2px solid #0891b2;
    outline-offset: 2px;
}

.special-coil-info {
    role: region;
    aria-live: polite;
}

/* Loading states */
.btn-action[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Validation states za ZV polje */
#rollerReplacementTime:invalid {
    border-color: #dc2626;
    background: rgba(220, 38, 38, 0.05);
}

    #rollerReplacementTime:invalid:focus {
        box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
    }

/* Success state */
#rollerReplacementTime:valid:not(:placeholder-shown) {
    border-color: #16a34a;
    background: rgba(22, 163, 74, 0.05);
}

    #rollerReplacementTime:valid:not(:placeholder-shown):focus {
        box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
    }

/* =============== CONTRACTS TABLE SPECIFIC STYLES =============== */
.contracts-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    min-width: 1200px; /* Ensures all columns are visible */
}

.contracts-table th {
    background: linear-gradient(180deg, #172033, #131c2e);
    color: #c9d6ff;
    font-weight: 700;
    font-size: 11px;
    text-align: left;
    padding: 12px 8px;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Explicit column widths to prevent spacing issues */
.contracts-table th:nth-child(1) { width: 16%; } /* Kupac / Ugovor */
.contracts-table th:nth-child(2) { width: 14%; } /* Specifikacije */
.contracts-table th:nth-child(3) { width: 8%; }  /* Naručeno */
.contracts-table th:nth-child(4) { width: 8%; }  /* Obojeno */
.contracts-table th:nth-child(5) { width: 8%; }  /* Preostalo */
.contracts-table th:nth-child(6) { width: 11%; } /* Status ugovora */
.contracts-table th:nth-child(7) { width: 12%; } /* Status */
.contracts-table th:nth-child(8) { width: 8%; }  /* Rok */
.contracts-table th:nth-child(9) { width: 9%; } /* Boje */
.contracts-table th:nth-child(10) { width: 6%; } /* Akcije */

.contracts-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #1f2a40;
    background: transparent;
    color: var(--text);
    font-size: 12px;
    vertical-align: top;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contracts-table td:nth-child(1) { width: 16%; }
.contracts-table td:nth-child(2) { width: 14%; }
.contracts-table td:nth-child(3) { width: 8%; }
.contracts-table td:nth-child(4) { width: 8%; }
.contracts-table td:nth-child(5) { width: 8%; }
.contracts-table td:nth-child(6) { width: 11%; }
.contracts-table td:nth-child(7) { width: 12%; }
.contracts-table td:nth-child(8) { width: 8%; }
.contracts-table td:nth-child(9) { width: 9%; }
.contracts-table td:nth-child(10) { width: 6%; }

/* Status cell styling */
.status-cell {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 8px 6px !important;
}

.status-cell .table-badge {
    width: 95%;
    box-sizing: border-box;
    text-align: center;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* Default fallback style */
    background: #6b7280;
    color: white;
    border: 1px solid transparent;
}

/* Table badge colors */
.table-badge.zaostatak {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: white;
    border-color: #dc2626;
}

.table-badge.tekuci {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border-color: #f59e0b;
}

.table-badge.dalji {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border-color: #10b981;
}

.table-badge.ima-boje {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    border-color: #22c55e;
}

.table-badge.nema-boje {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: white;
    border-color: #dc2626;
}

.table-badge.stize-tokom {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border-color: #3b82f6;
}

.table-badge.stize-nakon {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
    border-color: #8b5cf6;
}

/* Table container styling */
.table-view {
    background: var(--card);
    border-radius: 12px;
    overflow-x: auto;
    overflow-y: visible;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 20px;
    min-width: 0;
}

.table-view::-webkit-scrollbar {
    height: 8px;
}

.table-view::-webkit-scrollbar-track {
    background: var(--panel-2);
    border-radius: 4px;
}

.table-view::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.table-view::-webkit-scrollbar-thumb:hover {
    background: var(--muted);
}

/* Contract details row styling */
.contract-details-row {
    display: none;
}

.contract-details-row.show {
    display: table-row;
}

.contract-details-content {
    padding: 20px;
    background: var(--sidebar);
    border-radius: 8px;
    margin: 10px 0;
}

.contract-details-content h4 {
    margin: 0 0 15px 0;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
}

/* Paint layers grid - increase height */
.paint-layers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    max-height: 400px; /* Increased from default */
    overflow-y: auto;
    padding: 5px;
}

.paint-layer-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 15px;
    min-height: 120px; /* Ensure minimum height */
}

.paint-layer-card.available {
    border-left: 4px solid var(--success);
}

.paint-layer-card.unavailable {
    border-left: 4px solid var(--danger);
}

.layer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
}

.layer-title {
    font-weight: 600;
    color: var(--text);
    font-size: 13px;
}

.layer-status {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.layer-status.available {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.layer-status.unavailable {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.layer-details {
    font-size: 11px;
    line-height: 1.4;
    color: var(--muted);
}

/* ══════════════════════════════════════════════════════
   SHARED FORM MODAL STYLES  (assets, pm-plans, spareparts,
   failures, workorders …)
   ══════════════════════════════════════════════════════ */
.wo-modal {
    width: min(660px, 95vw);
    background: var(--surface, #0f172a);
    border: 1px solid var(--border, #1e293b);
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0,0,0,.6);
    overflow: hidden;
}

.wo-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border, #1e293b);
    background: var(--surface-2, #131f35);
}

.wo-modal-header h2 {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text, #e2e8f0);
}

.wo-modal-header p {
    margin: 0;
    font-size: 12px;
    color: var(--muted, #64748b);
}

.wo-modal-close {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: var(--muted, #64748b);
    padding: 2px 6px;
    border-radius: 6px;
    transition: background .15s, color .15s;
    flex-shrink: 0;
}
.wo-modal-close:hover { background: rgba(239,68,68,.2); color: #ef4444; }

.wo-form {
    padding: 20px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.wo-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.wo-form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
}

.wo-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wo-full { grid-column: 1 / -1; }

.wo-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--muted, #64748b);
}

.wo-input {
    background: var(--surface-2, #131f35);
    color: var(--text, #e2e8f0);
    border: 1px solid var(--border, #1e293b);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 13px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    width: 100%;
    box-sizing: border-box;
}
.wo-input:focus {
    border-color: var(--accent, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.wo-input::placeholder { color: var(--muted, #64748b); opacity: .7; }
.wo-input[readonly] {
    background: var(--panel-2, #0d1929);
    color: var(--muted, #64748b);
    cursor: default;
}

.wo-textarea {
    resize: vertical;
    min-height: 68px;
    font-family: inherit;
    line-height: 1.5;
}

.wo-checkbox-row {
    padding: 10px 14px;
    background: rgba(245,158,11,.08);
    border: 1px solid rgba(245,158,11,.2);
    border-radius: 8px;
}

.wo-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.wo-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--warning, #f59e0b);
    flex-shrink: 0;
}

.wo-checkbox-text {
    font-size: 13px;
    color: var(--text, #e2e8f0);
    font-weight: 500;
}

.wo-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 6px;
    border-top: 1px solid var(--border, #1e293b);
    margin-top: 4px;
}

.wo-modal-actions .btn-primary {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 20px;
    font-size: 13px;
    font-weight: 600;
}

@media (max-width: 520px) {
    .wo-modal { width: 98vw; }
    .wo-form-row, .wo-form-row-3 { grid-template-columns: 1fr; }
}

/* Card view enhancements */
.card-paint-info {
    margin-top: 12px;
    padding: 8px 12px;
    background: var(--sidebar);
    border-radius: 6px;
    font-size: 11px;
    color: var(--muted);
}

.card-actions {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.card-details-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.card-details-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* Modal styles */
.contract-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.8);
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    max-width: 90vw;
    max-height: 90vh;
    width: 800px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    z-index: 10000;
}

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

.modal-header h3 {
    margin: 0;
    color: var(--text);
    font-size: 16px;
    font-weight: 600;
}

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

.modal-close:hover {
    background: var(--border);
    color: var(--text);
}

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

/* =============== LIGHT THEME OVERRIDE FOR LEAN PAGES =============== */
body.lean-page {
    background: #f8fafc !important;
    color: #1e293b !important;
    display: flex;
    width: 100%;
    min-height: 100vh;
}

body.lean-page .main-content {
    background: #f8fafc;
    flex: 1;
    width: 100%;
    overflow-x: auto;
}

body.lean-page .sidebar {
    background: #0f172a;
    border-right: 1px solid #e2e8f0;
}