/* Материалы по участкам — современный дизайн */
.areas-materials-wrapper {
    padding: 28px 36px 48px;
    max-width: 1280px;
    margin: 0 auto;
    font-family: 'Inter', 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* Заголовок */
.areas-materials-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 32px;
    padding: 0;
}

.areas-materials-header h2 {
    margin: 0;
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--dark-text);
    letter-spacing: -0.03em;
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.areas-materials-header h2 i {
    color: var(--primary);
    font-size: 1.25rem;
    opacity: 0.9;
}

.areas-version {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--dark-text-secondary);
}

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

.areas-materials-legend {
    display: flex;
    gap: 20px;
    font-size: 0.8rem;
    color: var(--dark-text-secondary);
}

.areas-materials-legend span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.areas-materials-legend .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.areas-materials-legend .dot-ok { background: #22c55e; }
.areas-materials-legend .dot-low { background: #eab308; }
.areas-materials-legend .dot-none { background: #ef4444; }

.areas-materials-print-btns {
    display: flex;
    gap: 10px;
}

.areas-materials-print-btns button {
    padding: 10px 18px;
    border-radius: 8px;
    border: none;
    background: var(--dark-card);
    color: var(--dark-text);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s, transform 0.15s;
    border: 1px solid var(--dark-border);
}

.areas-materials-print-btns button:hover {
    background: var(--dark-hover);
    transform: translateY(-1px);
}

.areas-materials-print-btns button:first-child {
    background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
    color: #fff;
    border-color: transparent;
}

.areas-materials-print-btns button:last-child {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    border-color: transparent;
}

/* Карта участков */
.am-schema {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.am-section {
    background: var(--dark-card);
    border-radius: 12px;
    padding: 20px 24px;
    border: 1px solid var(--dark-border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.am-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark-text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.am-section-sub {
    font-size: 0.75rem;
    color: var(--dark-text-secondary);
    opacity: 0.85;
    margin-bottom: 12px;
}

.am-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.am-cell {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.am-cell:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.am-cell.am-ok {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.35);
}

.am-cell.am-ok:hover {
    background: rgba(34, 197, 94, 0.22);
}

.am-cell.am-low {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
    border: 1px solid rgba(234, 179, 8, 0.35);
}

.am-cell.am-low:hover {
    background: rgba(234, 179, 8, 0.22);
}

.am-cell.am-none {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.4);
    animation: am-alert 2s ease-in-out infinite;
}

.am-cell.am-none:hover {
    background: rgba(239, 68, 68, 0.22);
}

@keyframes am-alert {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
    50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

.am-cell .am-count {
    font-size: 0.7rem;
    opacity: 0.75;
    font-weight: 500;
}

.am-arrow {
    color: var(--dark-border);
    font-size: 0.75rem;
}

.am-node {
    padding: 6px 12px;
    background: var(--dark-surface);
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--dark-text-secondary);
}

/* Модалка */
.am-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 24px;
    animation: am-fadeIn 0.2s ease;
}

@keyframes am-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.am-modal {
    background: var(--dark-card);
    border-radius: 16px;
    max-width: 780px;
    width: 100%;
    max-height: 88vh;
    overflow: hidden;
    border: 1px solid var(--dark-border);
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.4);
    animation: am-slideUp 0.25s ease;
}

@keyframes am-slideUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.am-modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--dark-text);
}

.am-modal-close {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--dark-text-secondary);
    cursor: pointer;
    font-size: 1.25rem;
    transition: background 0.2s, color 0.2s;
}

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

.am-modal-body {
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.am-photo-main {
    width: 100%;
    max-height: 50vh;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
    background: var(--dark-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.am-photo-main img {
    max-width: 100%;
    max-height: 50vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    vertical-align: top;
}

.am-photo-placeholder {
    padding: 80px 32px;
    text-align: center;
    color: var(--dark-text-secondary);
    font-size: 0.9375rem;
}

.am-photo-placeholder i {
    display: block;
    margin-bottom: 16px;
    opacity: 0.4;
}

.am-photo-thumbs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.am-photo-thumb {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    flex-shrink: 0;
}

.am-photo-thumb:hover {
    border-color: var(--dark-border);
}

.am-photo-thumb.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.3);
}

.am-photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.am-photo-thumb.am-done {
    opacity: 0.75;
}

.am-photo-thumb.am-done img {
    filter: grayscale(0.5);
}

.am-photo-thumb.am-done::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        transparent 42%,
        rgba(0,0,0,0.85) 46%,
        rgba(0,0,0,0.85) 54%,
        transparent 58%
    );
}

.am-photo-thumb .am-thumb-badge {
    position: absolute;
    bottom: 4px;
    left: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
}

.am-thumb-badge.am-low { background: rgba(234, 179, 8, 0.9); color: #000; }
.am-thumb-badge.am-none { background: rgba(239, 68, 68, 0.9); color: #fff; }

.am-photo-status {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-shrink: 0;
}

.am-photo-status .am-btn-done {
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #fff;
    transition: transform 0.15s, box-shadow 0.2s;
}

.am-photo-status .am-btn-done:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.35);
}

.am-photo-meta {
    font-size: 0.8125rem;
    color: var(--dark-text-secondary);
    margin-top: 12px;
}

/* Печать QR */
.areas-qr-print { display: none; }

@media print {
    .areas-qr-print { display: block !important; padding: 16px; }
    .areas-qr-print .qr-card { break-inside: avoid; }
    body * { visibility: hidden; }
    .areas-qr-print, .areas-qr-print * { visibility: visible; }
    .areas-qr-print { position: absolute; left: 0; top: 0; width: 100%; background: #fff; color: #000; }
}

.qr-print-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.qr-card {
    border: 1px solid #e5e7eb;
    padding: 16px;
    text-align: center;
    border-radius: 12px;
}

.qr-card .qr-label { font-weight: 600; margin-bottom: 10px; font-size: 0.9375rem; }
.qr-card .qr-img { width: 120px; height: 120px; margin: 0 auto 10px; }
.qr-card .qr-url { font-size: 0.7rem; word-break: break-all; color: #6b7280; }
