/**
 * SYSTEM CRM: экскурсии — галерея, слоты, transfer, просмотр локации, sat-pop work_dates.
 * Подключать после crm-work-calendar.css.
 */

:is(body.sys-crm-page) .modal-box.crm-modal-wide {
    width: 720px;
    max-width: 96vw;
}
.crm-gallery-panel { margin-top: 4px; }
.crm-gallery-hint { font-size: 10px; color: #666; margin: 0 0 8px; line-height: 1.45; }
.crm-gallery-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.crm-gallery-add-btn {
    padding: 8px 14px; border: none; border-radius: 6px; background: #007bff; color: #fff;
    font-size: 11px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.crm-gallery-add-btn:hover:not(:disabled) { background: #0069d9; }
.crm-gallery-add-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.crm-gallery-count { font-size: 11px; color: #495057; font-weight: 600; }
.crm-exc-sub-hint { font-size: 11px; color: #666; margin: 0 0 10px; line-height: 1.4; }
.crm-gallery-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
    max-width: 100%;
}
@media (max-width: 520px) { .crm-gallery-grid { grid-template-columns: repeat(2, 1fr); } }
.crm-gallery-item {
    position: relative; border: 1px solid #dee2e6; border-radius: 8px; overflow: hidden;
    aspect-ratio: 4/3; background: #f1f3f5;
}
.crm-gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; vertical-align: top; }
.crm-gallery-del {
    position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border: none; border-radius: 6px;
    background: rgba(220,53,69,0.92); color: #fff; font-size: 16px; line-height: 1; cursor: pointer; font-weight: 700;
    display: flex; align-items: center; justify-content: center; padding: 0;
}
.crm-gallery-del:hover { background: #c82333; }
.crm-gallery-empty { font-size: 11px; color: #888; margin: 0; grid-column: 1 / -1; }
.crm-exc-upload-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.crm-exc-upload-row input[type=file] { flex: 1; min-width: 160px; font-size: 11px; }
.crm-exc-mini-table { width: 100%; font-size: 11px; border-collapse: collapse; margin-top: 8px; }
.crm-exc-mini-table th, .crm-exc-mini-table td { border: 1px solid #e8e8e8; padding: 6px 8px; text-align: left; }
.crm-exc-mini-table th { background: #f8f9fa; }
.crm-exc-slot-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-top: 10px; }
.crm-exc-slot-form label { margin: 0; font-size: 10px; }
.crm-exc-slot-form input { margin-top: 2px; width: auto; min-width: 100px; }
.crm-exc-slot-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 10px; }
.crm-exc-slot-toolbar label { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; cursor: pointer; margin: 0; font-weight: 600; }
.crm-exc-slot-toolbar input[type=checkbox] { width: auto; margin: 0; }
.crm-exc-slots-dual {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 12px;
    align-items: start;
    margin-top: 8px;
}
.crm-exc-slots-divider {
    width: 1px;
    align-self: stretch;
    min-height: 48px;
    background: linear-gradient(to bottom, transparent, #c5ccd4 12%, #c5ccd4 88%, transparent);
}
@media (max-width: 560px) {
    .crm-exc-slots-dual { grid-template-columns: 1fr; }
    .crm-exc-slots-divider { display: none; }
}
.crm-exc-slots-col-title { font-size: 11px; font-weight: 700; margin: 0 0 8px; color: #333; }
.crm-exc-slots-pills { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.crm-exc-slots-col-empty { font-size: 11px; color: #888; margin: 0; line-height: 1.4; max-width: 280px; }
.crm-exc-slot-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    background: #0c2461;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}
.crm-exc-slot-pill-time { letter-spacing: 0.02em; white-space: nowrap; }
.crm-exc-slot-pill-apply {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: #28a745;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
}
.crm-exc-slot-pill-apply:hover { background: #218838; }
.crm-exc-slot-pill-apply-icon { font-size: 15px; font-weight: 800; line-height: 1; }
.crm-exc-slot-pill-del {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: #dc3545;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
}
.crm-exc-slot-pill-del:hover { background: #c82333; }
.crm-exc-slot-pill-del-icon { font-size: 14px; line-height: 1; }
.crm-exc-xfer-wrap { margin-top: 4px; }
.crm-exc-xfer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: start;
}
@media (max-width: 640px) { .crm-exc-xfer-grid { grid-template-columns: 1fr; } }
.crm-exc-xfer-col-title { font-size: 11px; font-weight: 700; margin: 0 0 8px; color: #333; }
.crm-exc-xfer-list { display: flex; flex-direction: column; gap: 8px; min-height: 20px; }
.crm-exc-xfer-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #f3f5f7;
    border: 1px solid #5ab0e8;
    box-sizing: border-box;
    min-height: 48px;
}
.crm-exc-xfer-row--linked { border-color: #7ec89a; }
.crm-exc-xfer-thumb {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #e0e4e8;
    display: flex;
    align-items: center;
    justify-content: center;
}
.crm-exc-xfer-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.crm-exc-xfer-thumb-ph { width: 18px; height: 18px; border-radius: 4px; background: #cfd4da; display: block; }
.crm-exc-xfer-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.crm-exc-xfer-title { font-size: 12px; font-weight: 700; color: #0d8ecf; line-height: 1.25; word-break: break-word; }
.crm-exc-xfer-row--linked .crm-exc-xfer-title { color: #c0392b; }
.crm-exc-xfer-sub { font-size: 11px; color: #555; line-height: 1.25; min-height: 0; }
.crm-exc-xfer-empty { font-size: 11px; color: #888; margin: 0; padding: 6px 0; }
.crm-exc-xfer-add {
    flex-shrink: 0;
    width: 38px;
    height: 34px;
    border: none;
    border-radius: 8px;
    background: #dc3545;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}
.crm-exc-xfer-add:hover { background: #c82333; }
.crm-exc-xfer-del {
    flex-shrink: 0;
    width: 38px;
    height: 34px;
    border: none;
    border-radius: 8px;
    background: #28a745;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}
.crm-exc-xfer-del:hover { background: #218838; }
.crm-exc-empty { color: #888; font-size: 11px; margin: 8px 0 0; }
.crm-exc-err { color: #b02a37; font-size: 11px; }
td.crm-table-stack small { line-height: 1.45; }
.crm-exc-refusal-grid { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-top: 4px; }
.crm-exc-refusal-grid label { margin-top: 0; font-size: 10px; }
.crm-exc-refusal-grid input[type=number] { width: 72px; margin-top: 3px; padding: 6px 8px; }
.crm-exc-refusal-summary { font-size: 11px; color: #333; margin-top: 8px; line-height: 1.45; min-height: 1.35em; }
.crm-exc-refusal-hint { font-size: 9px; color: #888; margin-top: 4px; line-height: 1.35; }
.crm-exc-system-meta { font-size: 13px; line-height: 1.45; color: #1a1d21; max-width: 560px; }
.crm-exc-system-meta dt {
    margin: 14px 0 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
}
.crm-exc-system-meta dt:first-child { margin-top: 0; }
.crm-exc-system-meta dd { margin: 0; font-weight: 500; word-break: break-word; }
.crm-exc-sat-pop { z-index: 2100; align-items: center; justify-content: center; }
.crm-exc-sat-pop .modal-box { position: relative; max-height: 90vh; overflow: auto; }
.crm-exc-actions-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.crm-exc-actions-row { display: flex; flex-wrap: wrap; gap: 2px; justify-content: flex-end; align-items: center; }
.btn-icon.crm-row-quick svg { width: 20px; height: 20px; display: block; }
.crm-exc-sat-pop[data-crm-exc-sat-kind="work_dates"] .modal-box {
    width: min(680px, 96vw);
    max-width: min(680px, 96vw);
    box-sizing: border-box;
}
.crm-exc-sat-pop[data-crm-exc-sat-kind="work_dates"] .crm-work-dates-inner {
    flex-wrap: nowrap;
    justify-content: flex-start;
}
@media (max-width: 560px) {
    .crm-exc-sat-pop[data-crm-exc-sat-kind="work_dates"] .crm-work-dates-inner {
        flex-wrap: wrap;
    }
}
.crm-exc-sat-pop[data-crm-exc-sat-kind="work_dates"] .crm-work-cal-col {
    flex: 0 0 auto;
    min-width: 240px;
    max-width: 340px;
}
.crm-exc-sat-pop[data-crm-exc-sat-kind="work_dates"] .crm-work-side-col {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
    width: auto;
}
.crm-exc-sat-pop[data-crm-exc-sat-kind="work_dates"] .crm-work-chips {
    grid-template-columns: repeat(auto-fill, minmax(5.25rem, 1fr));
}
.crm-exc-sat-pop[data-crm-exc-sat-kind="work_dates"] .crm-work-dates-ul {
    grid-template-columns: repeat(auto-fill, minmax(5.25rem, 1fr));
    overflow-x: hidden;
}
#crmLocationViewPop { z-index: 2200; align-items: center; justify-content: center; }
#crmLocationViewPop .crm-locview-box {
    background: #fff; border-radius: 10px; width: min(720px, 96vw); max-height: 92vh;
    overflow: auto; box-shadow: 0 8px 32px rgba(0,0,0,.2); display: flex; flex-direction: column;
}
#crmLocationViewPop .crm-locview-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 12px 16px; border-bottom: 1px solid #e8e8e8;
}
#crmLocationViewPop .crm-locview-title { font-size: 16px; font-weight: 700; margin: 0; flex: 1; min-width: 0; }
#crmLocationViewPop .crm-locview-close {
    border: none; background: #6c757d; color: #fff; width: 34px; height: 34px;
    border-radius: 6px; cursor: pointer; font-size: 18px; line-height: 1; flex-shrink: 0;
}
#crmLocationViewPop .crm-locview-close:hover { background: #5a6268; }
#crmLocationViewPop .crm-locview-body { padding: 14px 16px 16px; }
#crmLocationViewPop .crm-locview-place-line {
    margin: 6px 0 0; font-size: 14px; line-height: 1.45;
}
#crmLocationViewPop .crm-locview-place-line:first-child { margin-top: 0; }
#crmLocationViewPop .crm-locview-coords {
    margin-top: 14px; padding-top: 12px; border-top: 1px solid #eee;
    font-size: 13px; color: #333;
}
#crmLocationViewPop .crm-locview-coords-row { margin: 4px 0; }
#crmLocationViewPop .crm-locview-coords-label { color: #666; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
#crmLocationViewPop .crm-locview-coords-val { font-variant-numeric: tabular-nums; font-weight: 600; }
#crmLocationViewPop .crm-locview-map-wrap { margin-top: 14px; }
#crmLocationViewPop .crm-locview-map {
    width: 100%; height: min(380px, 50vh); border-radius: 8px; border: 1px solid #ddd; background: #f0f0f0;
}
#crmLocationViewPop .crm-locview-map-hint { font-size: 11px; color: #856404; margin: 6px 0 0; min-height: 16px; }
