/* Machines page */

.machines-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0;
}

.machines-tab {
    padding: 10px 20px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.machines-tab:hover { color: var(--text-primary); }
.machines-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.machines-panel { display: none; }
.machines-panel.active { display: block; }

/* ── Overview: machine cards grid ── */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.machine-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    cursor: default;
}

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

.machine-card-number {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.machine-card-operator {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.machine-card-status {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.machine-card-status.idle {
    background: #f3f4f6;
    color: #9ca3af;
}
.machine-card-status.busy {
    background: #dcfce7;
    color: #16a34a;
}

.machine-card-stats {
    display: flex;
    gap: 16px;
    margin-top: 8px;
}

.machine-card-stat {
    font-size: 12px;
    color: var(--text-secondary);
}
.machine-card-stat strong {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
}

.machine-card-batches {
    margin-top: 10px;
    border-top: 1px solid #f0f0f0;
    padding-top: 8px;
}

.machine-card-batch {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 13px;
    color: var(--text-secondary);
}
.machine-card-batch-label { font-weight: 600; color: var(--text-primary); }
.machine-card-batch-qty { font-weight: 500; }

/* ── Manage: machines list table ── */
.machines-manage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.machines-manage-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.machines-table-actions {
    display: flex;
    gap: 8px;
}
.machines-table-actions button {
    padding: 6px 12px;
    border: 1px solid #e0e0e0;
    background: #fff;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-secondary);
}
.machines-table-actions button:hover { background: #f5f5f5; }
.machines-table-actions .btn-danger { color: #dc2626; border-color: #fecaca; }
.machines-table-actions .btn-danger:hover { background: #fef2f2; }

.machines-qr-cell {
    width: 48px;
}
.machines-qr-cell img {
    width: 40px;
    height: 40px;
    cursor: pointer;
    border-radius: 4px;
}

/* ── Modal ── */
.machines-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}
.machines-modal-overlay.active { display: flex; }

.machines-modal {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.machines-modal-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
}

.machines-modal-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}
.machines-modal-body label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.machines-input {
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 15px;
    outline: none;
    width: 100%;
    box-sizing: border-box;
}
.machines-input:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(26,115,232,0.1); }

.machines-modal-actions {
    display: flex;
    gap: 10px;
}

/* ── Salary ── */
.salary-controls {
    margin-bottom: 20px;
}

.salary-period {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.salary-period label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}
.salary-period .machines-input {
    width: auto;
}

.salary-table { width: 100%; }

.salary-row-total {
    font-weight: 700;
    font-size: 15px;
    border-top: 2px solid var(--border-color);
}

/* ── QR Print modal ── */
.qr-print-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 3000;
    align-items: center;
    justify-content: center;
}
.qr-print-overlay.active { display: flex; }

.qr-print-card {
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.qr-print-card img { width: 200px; height: 200px; margin-bottom: 16px; }
.qr-print-card .qr-label { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.qr-print-card .qr-operator { font-size: 16px; color: #666; margin-bottom: 16px; }
.qr-print-card .qr-actions { display: flex; gap: 10px; justify-content: center; }

@media (max-width: 768px) {
    .overview-grid { grid-template-columns: 1fr; }
    .salary-period { flex-direction: column; align-items: stretch; }
}
