* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f0f2f6;
    min-height: 100vh;
    color: #1c2535;
}
.container { max-width: 1600px; margin: 0 auto; padding: 16px 20px; }

/* ===== ТОПБАР (sticky nav) ===== */
.app-topbar {
    background: linear-gradient(135deg, #0d1f45 0%, #1a3568 100%);
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 2px 14px rgba(0,0,0,0.28);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.app-topbar .container { padding-top: 0; padding-bottom: 0; max-width: none; }

/* ===== SIDEBAR LAYOUT ===== */
.app-body {
    display: flex;
    min-height: calc(100vh - 58px);
}

.sidebar {
    width: 224px;
    flex-shrink: 0;
    background: white;
    border-right: 1px solid #e4e8f0;
    position: sticky;
    top: 58px;
    height: calc(100vh - 58px);
    overflow-y: auto;
    z-index: 100;
    padding: 10px 8px 20px;
    scrollbar-width: thin;
    scrollbar-color: #e0e0e0 transparent;
    transition: transform 0.25s cubic-bezier(.4,0,.2,1), box-shadow 0.25s;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

.main-content {
    flex: 1;
    min-width: 0;
    padding: 16px 20px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ===== SIDEBAR NAV ITEMS ===== */
.sidebar-section-label {
    font-size: 10px;
    font-weight: 700;
    color: #a0aab8;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 14px 12px 5px;
    user-select: none;
}
.sidebar-section-label:first-child { padding-top: 6px; }

.sidebar-divider {
    height: 1px;
    background: #f0f2f6;
    margin: 6px 4px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font-size: 13px;
    font-weight: 500;
    color: #4a5568;
    transition: all 0.15s;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-item:hover { background: #f0f4ff; color: #2a5298; }
.sidebar-item.active {
    background: #eef2ff;
    color: #1a3568;
    font-weight: 700;
}
.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 6px; bottom: 6px;
    width: 3px;
    background: #2a5298;
    border-radius: 0 3px 3px 0;
}
.sidebar-item-icon { font-size: 15px; flex-shrink: 0; }
.sidebar-item-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.sidebar-badge {
    flex-shrink: 0;
    background: #ff6b6b;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* ===== SIDEBAR OVERLAY (mobile) ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 58px; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.45);
    z-index: 99;
    animation: fadeIn 0.2s ease;
}
.sidebar-overlay.show { display: block; }

/* ===== HAMBURGER BUTTON ===== */
.sidebar-toggle {
    display: none;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    border-radius: 7px;
    width: 36px;
    height: 36px;
    font-size: 18px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.22); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.header {
    background: transparent;
    color: white;
    padding: 0;
    height: 58px;
    border-radius: 0;
    margin-bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 12px;
    box-shadow: none;
}
.header-left h1 { font-size: 17px; font-weight: 700; letter-spacing: -0.2px; }
.header-left .date { font-size: 11px; opacity: 0.65; margin-top: 2px; }
.shift-panel { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.shift-selector { display: flex; background: rgba(255,255,255,0.12); border-radius: 8px; overflow: hidden; border: 1px solid rgba(255,255,255,0.15); }
.shift-btn { padding: 7px 14px; border: none; background: transparent; color: rgba(255,255,255,0.85); cursor: pointer; font-size: 13px; font-weight: 600; transition: all 0.2s; white-space: nowrap; }
.shift-btn.active { background: rgba(255,255,255,0.22); color: white; }
.shift-btn:hover:not(.active) { background: rgba(255,255,255,0.1); color: white; }
.btn-operator { background: #fd7e14; color: white; }
.btn-operator:hover { background: #e0690a; }
.operator-area { background: white; border-radius: 12px; padding: 20px; margin-top: 20px; box-shadow: 0 3px 10px rgba(0,0,0,0.1); }
.stats-grid { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.stat-card { background: white; padding: 11px 18px; border-radius: 10px; border: 1px solid #e4e8f0; box-shadow: 0 1px 4px rgba(0,0,0,0.06); text-align: center; cursor: pointer; transition: all 0.18s; flex: 1; min-width: 90px; }
.stat-card:hover { border-color: #2a5298; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(42,82,152,0.13); }
.stat-number { font-size: 22px; font-weight: 700; color: #1a3568; }
.stat-label { font-size: 11px; color: #8896a7; margin-top: 2px; font-weight: 500; }
.tabs { background: white; border: 1px solid #e4e8f0; border-radius: 10px; padding: 5px; display: flex; gap: 2px; margin-bottom: 14px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: thin; scrollbar-color: #d0d0d0 transparent; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.tabs::-webkit-scrollbar { height: 3px; }
.tabs::-webkit-scrollbar-thumb { background: #d0d0d0; border-radius: 2px; }
.tabs::-webkit-scrollbar-track { background: transparent; }
.tab { padding: 7px 15px; background: transparent; border: none; border-radius: 7px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.18s; color: #5a6a7e; white-space: nowrap; box-shadow: none; }
.tab:hover { background: #f0f4ff; color: #2a5298; transform: none; }
.tab.active { background: #2a5298; color: white; box-shadow: 0 2px 8px rgba(42,82,152,0.22); }
.tab-badge { padding: 1px 6px; border-radius: 8px; font-size: 11px; margin-left: 4px; background: #ff6b6b; color: white; }
.tab.active .tab-badge { background: rgba(255,255,255,0.28); color: white; }
.section-content { display: none; }
.section-content.active { display: block; }
.filters-bar { background: white; padding: 9px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid #e4e8f0; box-shadow: 0 1px 4px rgba(0,0,0,0.06); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filter-group { display: flex; align-items: center; gap: 8px; }
.filter-group label { font-weight: 600; font-size: 13px; white-space: nowrap; }
.filter-select { padding: 7px 10px; border: 2px solid #e0e0e0; border-radius: 6px; font-size: 13px; cursor: pointer; }
.search-input { flex: 1; min-width: 140px; padding: 8px 12px; border: 2px solid #e0e0e0; border-radius: 6px; font-size: 13px; }
.btn { padding: 8px 16px; border: none; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s; white-space: nowrap; }
.btn-primary { background: #28a745; color: white; }
.btn-primary:hover { background: #218838; }
.btn-secondary { background: #6c757d; color: white; }
.btn-secondary:hover { background: #5a6268; }
.btn-danger { background: #dc3545; color: white; }
.btn-danger:hover { background: #c82333; }
.btn-export { background: #17a2b8; color: white; }
.btn-export:hover { background: #138496; }
.btn-warning { background: #ffc107; color: #333; }
.btn-warning:hover { background: #e0a800; }
.btn-info { background: #007bff; color: white; }
.btn-info:hover { background: #0069d9; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-xs { padding: 3px 7px; font-size: 11px; }
.plan-badge { display: inline-block; padding: 3px 10px; border-radius: 5px; font-size: 11px; font-weight: bold; }
.plan-ontime { background: #d4edda; color: #155724; }
.plan-delay { background: #fff3cd; color: #856404; }
.plan-critical { background: #f8d7da; color: #721c24; }
.planning-card { background: white; border-radius: 10px; padding: 18px 20px; margin-bottom: 14px; border: 1px solid #e4e8f0; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.planning-card h3 { color: #1a3568; margin-bottom: 14px; font-size: 16px; font-weight: 700; }
.workshop-header { background: white; padding: 16px 20px; border-radius: 10px; margin-bottom: 14px; border: 1px solid #e4e8f0; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.workshop-title { font-size: 18px; font-weight: 700; color: #1a3568; margin-bottom: 10px; }
.machines-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 12px; }
.machine-card { background: #f8f9fa; padding: 12px; border-radius: 8px; border-left: 4px solid #2a5298; }
.machine-name { font-weight: bold; color: #2a5298; margin-bottom: 6px; font-size: 14px; }
.machine-status { font-size: 12px; padding: 3px 8px; border-radius: 4px; display: inline-block; margin-bottom: 8px; }
.status-free { background: #d4edda; color: #155724; }
.status-busy { background: #fff3cd; color: #856404; }
.tasks-panel { background: white; border-radius: 10px; padding: 16px 20px; border: 1px solid #e4e8f0; box-shadow: 0 1px 4px rgba(0,0,0,0.06); overflow-x: auto; }
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; flex-wrap: wrap; gap: 10px; }
table { width: 100%; border-collapse: collapse; min-width: 1200px; }
th { background: #1a3568; color: white; padding: 9px 8px; text-align: left; font-weight: 600; font-size: 12px; white-space: nowrap; }
td { padding: 8px; border-bottom: 1px solid #eef0f5; font-size: 12px; }
tr:hover { background: #f5f7ff; }
tr.completed { background: #f0faf4; }
tr.completed td.part-name { text-decoration: line-through; color: #888; }
tr.paused { background: #f8f8fa; opacity: 0.85; }
tr.route-pending { background: #fafafa; opacity: 0.6; }
tr.route-pending:hover { background: #f5f5f5; opacity: 0.8; }
.route-step-row { display:flex; align-items:center; gap:8px; padding:8px 0; border-bottom:1px solid #f0f2f6; }
.route-step-num { width:24px; height:24px; border-radius:50%; background:#2a5298; color:white; font-size:11px; font-weight:700; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.status-select { padding: 5px 8px; border-radius: 5px; border: 2px solid #e0e0e0; font-size: 11px; font-weight: 600; }
.priority-urgent { background: #f8d7da; color: #721c24; padding: 2px 6px; border-radius: 4px; font-weight: bold; font-size: 11px; }
.priority-normal { background: #fff3cd; color: #856404; padding: 2px 6px; border-radius: 4px; font-size: 11px; }
.priority-low { background: #d4edda; color: #155724; padding: 2px 6px; border-radius: 4px; font-size: 11px; }
.progress-cell { min-width: 180px; }
.progress-info { display: flex; justify-content: space-between; font-size: 11px; margin-bottom: 3px; }
.progress-bar-small { width: 100%; height: 14px; background: #e0e0e0; border-radius: 7px; overflow: hidden; }
.progress-fill-small { height: 100%; background: linear-gradient(90deg, #28a745, #20c997); border-radius: 7px; transition: width 0.5s; display: flex; align-items: center; justify-content: center; color: white; font-size: 9px; font-weight: bold; }
.progress-fill-small.warning { background: linear-gradient(90deg, #ffc107, #ff9800); }
.progress-fill-small.danger { background: linear-gradient(90deg, #dc3545, #f44336); }
.file-indicator { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; padding: 3px 8px; border-radius: 4px; background: #e3f2fd; color: #1976d2; font-weight: 600; font-size: 11px; }
.file-indicator:hover { background: #bbdefb; }
.file-indicator.no-files { background: #f5f5f5; color: #999; cursor: default; }
.shift-history { margin-top: 8px; font-size: 10px; color: #666; }
.shift-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 3px; }
.shift-dot.day { background: #ffc107; }
.shift-dot.night { background: #6c5ce7; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; margin-bottom: 16px; }
.summary-card { background: white; border-radius: 10px; padding: 16px 18px; border: 1px solid #e4e8f0; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.summary-card h3 { color: #2a5298; margin-bottom: 12px; font-size: 16px; }
.summary-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #eee; font-size: 13px; }
.summary-value { font-weight: bold; font-size: 15px; }
.big-progress-bar { width: 100%; height: 18px; background: #e0e0e0; border-radius: 9px; overflow: hidden; margin-top: 8px; }
.big-progress-fill { height: 100%; background: linear-gradient(90deg, #28a745, #20c997); border-radius: 9px; transition: width 0.5s; }
.analytics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(450px, 1fr)); gap: 20px; margin-bottom: 20px; }
.analytics-card { background: white; border-radius: 12px; padding: 22px; border: 1px solid #e4e8f0; box-shadow: 0 1px 4px rgba(0,0,0,0.06); overflow: hidden; }
.analytics-card h3 { color: #1a3568; margin-bottom: 18px; font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.hbar-item { margin-bottom: 15px; }
.hbar-label { display: flex; justify-content: space-between; margin-bottom: 5px; font-size: 13px; }
.hbar-track { width: 100%; height: 24px; background: #e9ecef; border-radius: 12px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 12px; display: flex; align-items: center; padding-left: 10px; color: white; font-size: 12px; font-weight: bold; transition: width 0.8s ease; min-width: 40px; }
.hbar-fill.blue { background: linear-gradient(90deg, #2a5298, #4472C4); }
.hbar-fill.green { background: linear-gradient(90deg, #28a745, #20c997); }
.hbar-fill.orange { background: linear-gradient(90deg, #fd7e14, #ffc107); }
.hbar-fill.red { background: linear-gradient(90deg, #dc3545, #f8d7da); color: #721c24; }
.hbar-fill.purple { background: linear-gradient(90deg, #6f42c1, #a367dc); }
.hbar-fill.teal { background: linear-gradient(90deg, #17a2b8, #5bc0de); }
.pie-indicator { display: flex; align-items: center; justify-content: center; gap: 30px; flex-wrap: wrap; }
.pie-chart { width: 150px; height: 150px; border-radius: 50%; background: conic-gradient(#28a745 0deg, #28a745 var(--deg), #ffc107 var(--deg), #ffc107 var(--deg2), #dc3545 var(--deg2), #dc3545 360deg); position: relative; display: flex; align-items: center; justify-content: center; }
.pie-chart::after { content: ''; width: 100px; height: 100px; background: white; border-radius: 50%; position: absolute; }
.pie-center { position: relative; z-index: 1; text-align: center; font-weight: bold; }
.pie-legend { display: flex; flex-direction: column; gap: 10px; }
.pie-legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.pie-legend-color { width: 16px; height: 16px; border-radius: 4px; }
.analytics-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.analytics-table th { background: #4472C4; color: white; padding: 10px; text-align: left; font-size: 12px; }
.analytics-table td { padding: 10px; border-bottom: 1px solid #e0e0e0; }
.analytics-table tr:hover { background: #f8f9fa; }
.metric-value { font-size: 24px; font-weight: bold; color: #2a5298; }
.metric-label { font-size: 13px; color: #666; }
.metrics-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; margin-bottom: 20px; }
.metric-card { background: white; border-radius: 10px; padding: 16px 20px; text-align: center; border: 1px solid #e4e8f0; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.norm-indicator { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: bold; }
.norm-good { background: #d4edda; color: #155724; }
.norm-warning { background: #fff3cd; color: #856404; }
.norm-bad { background: #f8d7da; color: #721c24; }
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 1000; justify-content: center; align-items: center; }
.modal.active { display: flex !important; }
.modal-content { background: white; border-radius: 15px; padding: 25px; width: 90%; max-width: 600px; max-height: 85vh; overflow-y: auto; position: relative; }
.modal-content.wide { max-width: 1000px; }
.modal-header { font-size: 20px; font-weight: bold; color: #2a5298; margin-bottom: 18px; padding-bottom: 10px; border-bottom: 2px solid #e0e0e0; display: flex; justify-content: space-between; align-items: center; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: #999; }
.modal-close:hover { color: #333; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 4px; font-weight: 600; color: #333; font-size: 13px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 9px 11px; border: 2px solid #e0e0e0; border-radius: 6px; font-size: 14px; font-family: inherit; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.part-search-container { position: relative; }
.part-suggestions { position: absolute; top: 100%; left: 0; right: 0; background: white; border: 2px solid #2a5298; border-radius: 0 0 8px 8px; max-height: 200px; overflow-y: auto; z-index: 10; display: none; }
.part-suggestions.show { display: block; }
.part-suggestion-item { padding: 10px 12px; cursor: pointer; border-bottom: 1px solid #eee; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.part-suggestion-item:hover { background: #f0f4ff; }
.part-suggestion-item .part-code { color: #2a5298; font-weight: bold; }
.part-suggestion-item .part-info { color: #666; font-size: 11px; }
.file-upload { border: 2px dashed #ccc; padding: 15px; border-radius: 8px; text-align: center; cursor: pointer; font-size: 13px; color: #666; }
.file-upload:hover { border-color: #2a5298; background: #f0f4ff; }
.file-item { display: flex; justify-content: space-between; align-items: center; background: #f0f4ff; padding: 6px 10px; border-radius: 6px; margin-top: 6px; font-size: 12px; }
.modal-buttons { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; padding-top: 15px; border-top: 2px solid #e0e0e0; }
.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 15px; margin-top: 15px; }
.file-card { border: 2px solid #e0e0e0; border-radius: 10px; padding: 15px; text-align: center; cursor: pointer; transition: all 0.2s; background: #fafafa; }
.file-card:hover { border-color: #2a5298; box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.file-icon { font-size: 40px; margin-bottom: 10px; }
.file-name { font-weight: 600; font-size: 13px; color: #333; margin-bottom: 5px; }
.file-size { font-size: 11px; color: #999; }
.file-actions { display: flex; gap: 8px; margin-top: 10px; justify-content: center; }
.image-preview { max-width: 100%; max-height: 70vh; border-radius: 8px; }
.preview-container { text-align: center; padding: 20px; }
.database-table { width: 100%; border-collapse: collapse; }
.database-table th { background: #4472C4; padding: 10px; font-size: 13px; }
.database-table td { padding: 10px; font-size: 13px; }
.notification { position: fixed; top: 20px; right: 20px; padding: 12px 20px; border-radius: 8px; box-shadow: 0 8px 25px rgba(0,0,0,0.3); z-index: 2000; display: none; animation: slideIn 0.3s ease; color: white; font-weight: 600; }
.notification.show { display: block; }
.notification.success { background: #28a745; }
.notification.error { background: #dc3545; }
.notification.info { background: #007bff; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@media (max-width: 900px) {
    .analytics-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .machines-grid { grid-template-columns: 1fr; }
    .filters-bar { flex-direction: column; align-items: stretch; }
    .header { gap: 8px; flex-wrap: nowrap; }
    .header-left { gap: 8px !important; flex-wrap: nowrap; overflow: hidden; }
    .header-left h1 { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .header-left .date { display: none; }
    .login-roles { grid-template-columns: 1fr; }
    .main-content { padding: 10px; }
    .tasks-panel { padding: 12px; }
    .stats-grid { gap: 6px; }
    .stat-card { padding: 9px 12px; min-width: 70px; }
    .stat-number { font-size: 18px; }
    .shift-btn { padding: 6px 10px; font-size: 12px; }
    /* Сайдбар: скрыт, выезжает как overlay */
    .sidebar {
        position: fixed;
        top: 58px; left: 0; bottom: 0;
        z-index: 150;
        transform: translateX(-100%);
        box-shadow: none;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.18);
    }
    .sidebar-toggle { display: flex !important; }

    /* Модалки на весь экран */
    .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        margin: 0;
        height: 100vh;
    }

    /* Смена и кнопки в шапке */
    .shift-panel { flex-wrap: wrap; justify-content: center; gap: 6px; }
    .shift-selector { flex-wrap: wrap; }

    /* Оператор: карточки заданий */
    .op-task-table { display: none !important; }
    .op-task-cards { display: flex !important; }
    .op-stats-row { gap: 6px; }
    .op-stat-card { min-width: 80px; padding: 10px 8px; }
    .op-stat-num { font-size: 22px; }
    .op-welcome-info h3 { font-size: 18px; }

    /* Таблицы — горизонтальный скролл */
    .tasks-panel table { min-width: 700px; }
}

/* ---- Карточки задания (мобильный оператор) ---- */
.op-task-cards {
    display: none;
    flex-direction: column;
    gap: 12px;
    padding: 4px;
}
.op-task-card {
    background: #fff;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-left: 4px solid #2a5298;
}
.op-task-card.urgent  { border-left-color: #dc3545; }
.op-task-card.completed { border-left-color: #28a745; opacity: 0.75; }
.op-task-card.paused  { border-left-color: #6c757d; }
.op-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; gap: 8px; }
.op-card-title  { font-weight: 700; font-size: 15px; flex: 1; }
.op-card-body   { font-size: 13px; color: #666; margin-bottom: 10px; }
.op-card-progress { margin-bottom: 10px; }
.op-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.op-card-actions select { flex: 1; min-width: 130px; }

/* ===== СТРАНИЦА АВТОРИЗАЦИИ ===== */
#loginPage {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 25px 70px rgba(0,0,0,0.6);
    text-align: center;
    animation: loginFadeIn 0.4s ease;
}

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

.login-logo { font-size: 64px; margin-bottom: 12px; line-height: 1; }

.login-card h1 {
    font-size: 22px;
    color: #1e3c72;
    margin-bottom: 4px;
    font-weight: 700;
}

.login-version { font-size: 13px; color: #aaa; margin-bottom: 28px; }

.login-subtitle { color: #666; margin-bottom: 22px; font-size: 15px; }

.login-roles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 8px;
}

.login-role-card {
    border: 2px solid #e0e0e0;
    border-radius: 14px;
    padding: 28px 16px;
    cursor: pointer;
    transition: all 0.25s;
    background: #fafafa;
}

.login-role-card:hover {
    border-color: #2a5298;
    background: #f0f4ff;
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(42,82,152,0.2);
}

.login-role-icon  { font-size: 44px; margin-bottom: 12px; }
.login-role-name  { font-weight: 700; font-size: 16px; color: #222; margin-bottom: 6px; }
.login-role-desc  { font-size: 12px; color: #888; line-height: 1.4; }

.login-back {
    background: none;
    border: none;
    color: #2a5298;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    transition: opacity 0.2s;
}
.login-back:hover { opacity: 0.7; }

.login-role-selected {
    font-size: 20px;
    font-weight: 700;
    color: #1e3c72;
    margin-bottom: 22px;
    text-align: left;
}

.login-field { text-align: left; margin-bottom: 16px; }

.login-field label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: #444;
    margin-bottom: 6px;
}

.login-field input,
.login-field select {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: white;
}

.login-field input:focus,
.login-field select:focus {
    border-color: #2a5298;
    box-shadow: 0 0 0 3px rgba(42,82,152,0.12);
    outline: none;
}

.login-error {
    color: #dc3545;
    font-size: 13px;
    min-height: 22px;
    margin-bottom: 10px;
    text-align: left;
    font-weight: 500;
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #2a5298 0%, #1e3c72 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s;
    letter-spacing: 0.3px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(42,82,152,0.45);
}

.login-btn:active { transform: translateY(0); }

/* ===== ШАПКА: ПОЛЬЗОВАТЕЛЬ ===== */
#headerUserInfo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.admin-badge    { background: rgba(255,255,255,0.2); color: white; border: 1px solid rgba(255,255,255,0.35); }
.operator-badge { background: rgba(255,193,7,0.28);  color: #fff3cd; border: 1px solid rgba(255,193,7,0.5); }

.user-ws {
    font-size: 13px;
    opacity: 0.75;
    white-space: nowrap;
}

.btn-logout {
    background: rgba(220,53,69,0.75);
    color: white;
    border: 1px solid rgba(220,53,69,0.5);
}
.btn-logout:hover { background: rgba(220,53,69,1); }

.btn-keyicon {
    background: rgba(255,255,255,0.15);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    font-size: 16px;
    padding: 7px 10px;
}
.btn-keyicon:hover { background: rgba(255,255,255,0.28); }
.btn-notif {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    border-radius: 7px;
    width: 34px; height: 34px;
    font-size: 16px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding: 0;
    transition: background 0.15s;
    flex-shrink: 0;
}
.btn-notif:hover { background: rgba(255,255,255,0.22); }

/* ===== PIN INPUT ===== */
.pin-input {
    width: 100%;
    padding: 14px;
    font-size: 28px;
    letter-spacing: 12px;
    text-align: center;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-family: monospace;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fafafa;
}
.pin-input:focus {
    border-color: #2a5298;
    box-shadow: 0 0 0 3px rgba(42,82,152,0.12);
    outline: none;
    background: white;
}

.pin-badge {
    display: inline-block;
    background: #e8f0fe;
    color: #2a5298;
    padding: 2px 10px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 3px;
    margin-right: 6px;
}

.btn-pin-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.btn-pin-toggle:hover { opacity: 1; }

/* ===== ДЕДЛАЙНЫ: цвет строки ===== */
tr.dl-overdue { background: #fff0f0 !important; }
tr.dl-overdue:hover { background: #ffe4e4 !important; }
tr.dl-today   { background: #fff8e6 !important; }
tr.dl-today:hover   { background: #fff0cc !important; }
tr.dl-soon    { background: #fffde7 !important; }
tr.dl-soon:hover    { background: #fff9c4 !important; }

.deadline-tag {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.dl-tag-overdue  { background: #f8d7da; color: #721c24; }
.dl-tag-today    { background: #fff3cd; color: #856404; }
.dl-tag-soon     { background: #fff9c4; color: #7d6608; }
.dl-tag-ok       { background: #d4edda; color: #155724; }
.dl-tag-none     { background: #f5f5f5; color: #999; }

/* ===== ДАШБОРД ОПЕРАТОРА ===== */
.op-dashboard {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    border-radius: 14px;
    padding: 20px 24px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    box-shadow: 0 6px 20px rgba(42,82,152,0.35);
}

.op-welcome-info h3 { font-size: 20px; margin-bottom: 4px; }
.op-welcome-info p  { font-size: 13px; opacity: 0.85; margin: 2px 0; }

.op-stats-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.op-stat-card {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 10px;
    padding: 12px 18px;
    text-align: center;
    min-width: 90px;
}
.op-stat-card .op-stat-num {
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 4px;
}
.op-stat-card .op-stat-lbl {
    font-size: 11px;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.op-stat-card.urgent { background: rgba(220,53,69,0.35); border-color: rgba(220,53,69,0.5); }
.op-stat-card.done   { background: rgba(40,167,69,0.3);  border-color: rgba(40,167,69,0.5); }

.op-tasks-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 10px;
}
.op-tasks-header h4 { font-size: 17px; color: #2a5298; margin: 0; }

/* Urgent task highlight */
tr.task-urgent-row td { border-left: 3px solid #dc3545; }
tr.task-normal-row td { border-left: 3px solid transparent; }

/* ---- Разворачивающаяся панель задания оператора ---- */
.op-task-row { transition: background 0.15s; }
.op-task-row:hover td { background: #f0f4ff; }
.op-task-row.expanded td { background: #e8efff; border-bottom: none; }

.task-expand-row td {
    background: #f4f7ff;
    border-top: none;
    padding: 0 !important;
}

.task-expand-panel {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0;
    border-top: 2px solid #2a5298;
}

.expand-col {
    padding: 12px 16px;
    border-right: 1px solid #dde4f5;
}
.expand-col:last-child { border-right: none; }

.expand-col-title {
    font-size: 12px;
    font-weight: 700;
    color: #2a5298;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #dde4f5;
}

.expand-empty { color: #bbb; font-size: 12px; font-style: italic; padding: 4px 0; }

/* Инструменты */
.expand-tool-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 0;
    font-size: 12px;
}
.expand-tool-row.tool-missing { opacity: 0.75; }
.expand-tool-status { flex-shrink: 0; }
.expand-tool-name   { flex: 1; }
.expand-tool-qty    { color: #888; white-space: nowrap; }
.expand-tool-warn   { color: #dc3545; font-size: 11px; white-space: nowrap; }

/* Прогресс */
.expand-progress-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 3px 0;
    font-size: 12px;
    border-bottom: 1px dashed #eee;
}
.expand-progress-row:last-child { border-bottom: none; }
.expand-prog-shift  { flex-shrink: 0; }
.expand-prog-op     { flex: 1; font-weight: 600; color: #333; }
.expand-prog-qty    { color: #28a745; font-weight: 700; white-space: nowrap; }
.expand-prog-date   { color: #aaa; font-size: 11px; white-space: nowrap; }
.expand-prog-comment{ color: #666; font-size: 11px; font-style: italic; width: 100%; }

/* Комментарии */
.expand-comment-row { padding: 4px 0; border-bottom: 1px dashed #eee; }
.expand-comment-row:last-child { border-bottom: none; }
.expand-comment-meta { font-size: 10px; color: #aaa; margin-bottom: 2px; }
.expand-comment-text { font-size: 12px; color: #333; }

/* Карточка (мобильный) */
.task-expand-panel-card {
    margin: 8px 0;
    border-radius: 8px;
    border: 1px solid #dde4f5;
    overflow: hidden;
}
.task-expand-panel-card .task-expand-panel {
    grid-template-columns: 1fr;
    border-top: 2px solid #2a5298;
}
.task-expand-panel-card .expand-col {
    border-right: none;
    border-bottom: 1px solid #dde4f5;
}
.task-expand-panel-card .expand-col:last-child { border-bottom: none; }

@media (max-width: 768px) {
    .task-expand-panel { grid-template-columns: 1fr; }
    .expand-col { border-right: none; border-bottom: 1px solid #dde4f5; }
    .expand-col:last-child { border-bottom: none; }
}
