/* Customer Location Map — page-specific styles ported from the design bundle */

.clm-page { display:flex; flex-direction:column; height:calc(100vh - 60px); min-height:0; }

.clm-map-area { position:relative; flex:1; overflow:hidden; background:#E8EFF5; min-height:0; }
.clm-map-host { position:absolute; inset:0; }
.clm-loading {
    position:absolute; inset:0; z-index:50;
    display:flex; align-items:center; justify-content:center;
    background:rgba(248,250,252,0.85); backdrop-filter:blur(2px);
    flex-direction:column; gap:14px;
    color:var(--st-muted); font-size:13px;
}
.clm-loading-pulse {
    position:relative; width:56px; height:56px; display:inline-block;
}
.clm-loading-pulse::before, .clm-loading-pulse::after {
    content:""; position:absolute; inset:0; border-radius:50%;
    background:var(--st-primary); opacity:0.25;
    animation:clmPulse 1.6s ease-out infinite;
}
.clm-loading-pulse::after { animation-delay:0.8s; }
.clm-loading-pulse .core {
    position:absolute; left:50%; top:50%;
    width:16px; height:16px; margin:-8px 0 0 -8px; border-radius:50%;
    background:var(--st-primary); box-shadow:0 4px 12px rgba(74,118,249,0.4);
}
@keyframes clmPulse {
    0%   { transform:scale(0.4); opacity:0.6; }
    100% { transform:scale(1.6); opacity:0; }
}

/* Filter bar — floating, pinned top */
.clm-filterbar {
    position:absolute; top:14px; left:14px; right:14px;
    z-index:10;
    background:rgba(255,255,255,0.95);
    backdrop-filter:blur(8px);
    border:1px solid var(--st-border);
    border-radius:12px;
    padding:8px 10px;
    display:flex; align-items:center; gap:8px; flex-wrap:wrap;
    box-shadow:0 4px 12px rgba(15,23,42,0.06);
    font-size:13px;
}
.clm-search {
    display:flex; align-items:center; gap:8px;
    background:#F1F5F9; border-radius:8px;
    padding:6px 10px; min-width:240px;
    color:var(--st-muted);
}
.clm-search input {
    border:none; background:transparent; outline:none;
    font-size:13px; color:var(--st-text); width:100%;
    font-family:inherit;
}
.clm-search input::placeholder { color:var(--st-subtle); }

.clm-divider { width:1px; height:24px; background:var(--st-border); margin:0 2px; }

.clm-pill {
    display:inline-flex; align-items:center; gap:6px;
    padding:6px 12px; background:var(--st-white);
    border:1px solid var(--st-border); border-radius:9999px;
    font-size:12px; font-weight:500; color:#475569; cursor:pointer;
    transition:all 0.15s ease;
    font-family:inherit;
}
.clm-pill:hover { background:#F1F5F9; }
.clm-pill.on { background:var(--st-primary-light); border-color:var(--st-primary); color:var(--st-primary); }
.clm-pill .dot { width:8px; height:8px; border-radius:50%; }
.clm-pill-count {
    background:var(--st-primary); color:var(--st-white); font-size:10px; font-weight:700;
    padding:1px 6px; border-radius:9999px; margin-left:2px;
}

.clm-dept-wrap { position:relative; }
.clm-dropdown {
    position:absolute; top:calc(100% + 6px); left:0;
    background:var(--st-white); border:1px solid var(--st-border); border-radius:10px;
    padding:6px;
    box-shadow:0 8px 20px rgba(15,23,42,0.08);
    min-width:200px; max-height:320px; overflow-y:auto;
    z-index:20;
}
.clm-dropdown-row {
    display:flex; align-items:center; gap:8px;
    padding:7px 10px; border-radius:6px; cursor:pointer;
    font-size:13px; color:var(--st-text);
}
.clm-dropdown-row:hover { background:#F1F5F9; }
.clm-dropdown-row .dot { width:8px; height:8px; border-radius:50%; }

.clm-toggle {
    display:inline-flex; align-items:center; gap:6px;
    font-size:12px; color:var(--st-muted); cursor:pointer; padding:0 8px;
}
.clm-toggle input { margin:0; }

.clm-result-count { font-size:12px; color:var(--st-muted); margin-left:auto; padding:0 8px; }
.clm-result-count b { color:var(--st-text); font-weight:700; }
.clm-clear-all {
    background:none; border:none; color:var(--st-primary);
    font-size:12px; font-weight:600; cursor:pointer;
    padding:4px 8px; border-radius:6px; font-family:inherit;
}
.clm-clear-all:hover { background:var(--st-primary-light); }

.clm-missing-banner {
    position:absolute; bottom:14px; left:50%; transform:translateX(-50%);
    z-index:5;
    background:rgba(255,255,255,0.95); backdrop-filter:blur(8px);
    border:1px solid #FCD34D; border-radius:10px;
    padding:8px 14px; font-size:12px; color:#92400E;
    box-shadow:0 4px 12px rgba(15,23,42,0.06);
}

/* Detail panel — slides in from right */
.clm-panel {
    position:absolute; top:0; right:0; bottom:0;
    width:460px; background:var(--st-white);
    z-index:12;
    display:flex; flex-direction:column;
    box-shadow:-8px 0 30px rgba(15,23,42,0.10);
    border-left:1px solid var(--st-border);
    animation:clmSlideIn 0.25s ease-out;
}
@keyframes clmSlideIn {
    from { transform:translateX(20px); opacity:0; }
    to   { transform:translateX(0); opacity:1; }
}

.clm-head { padding:18px 20px 14px; border-bottom:1px solid var(--st-border); }
.clm-head-top { display:flex; align-items:flex-start; gap:10px; margin-bottom:6px; }
.clm-dept-pin {
    width:10px; height:10px; border-radius:50%;
    margin-top:6px; flex-shrink:0;
}
.clm-name {
    flex:1; font-size:18px; font-weight:800;
    color:var(--st-text-strong); letter-spacing:-0.01em; line-height:1.25;
}
.clm-close {
    width:28px; height:28px;
    border:1px solid var(--st-border); background:var(--st-white);
    border-radius:6px; cursor:pointer; color:var(--st-muted);
    display:flex; align-items:center; justify-content:center;
    flex-shrink:0;
}
.clm-close:hover { background:#F1F5F9; color:var(--st-text); }
.clm-addr { font-size:13px; color:var(--st-muted); margin:4px 0 10px; }
.clm-meta-row { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:12px; }
.clm-meta {
    background:#F1F5F9; border-radius:9999px;
    padding:3px 10px; font-size:11px; color:#475569; font-weight:500;
}
.clm-meta.warn { background:#FEF3C7; color:#92400E; }
.clm-meta.ok { background:#DCFCE7; color:#166534; }

.clm-actions { display:flex; gap:8px; flex-wrap:wrap; }
.clm-btn-primary {
    background:var(--st-primary); color:var(--st-white); border:none; border-radius:8px;
    padding:8px 12px; font-size:12px; font-weight:600;
    cursor:pointer; display:inline-flex; align-items:center; gap:6px;
    font-family:inherit;
}
.clm-btn-primary:hover { background:#3E63D5; }
.clm-btn-ghost {
    background:var(--st-white); color:#475569; border:1px solid var(--st-border);
    border-radius:8px; padding:8px 12px; font-size:12px; font-weight:600;
    cursor:pointer; display:inline-flex; align-items:center; gap:6px;
    font-family:inherit;
}
.clm-btn-ghost:hover { background:#F1F5F9; color:var(--st-text); }

.clm-tabs {
    display:flex; border-bottom:1px solid var(--st-border);
    padding:0 12px; gap:0; overflow-x:auto;
}
.clm-tabs button {
    background:transparent; border:none;
    padding:10px 12px; font-size:12px; font-weight:600;
    color:var(--st-muted); cursor:pointer;
    border-bottom:2px solid transparent;
    white-space:nowrap; margin-bottom:-1px;
    font-family:inherit;
}
.clm-tabs button:hover { color:var(--st-text); }
.clm-tabs button.on { color:var(--st-primary); border-bottom-color:var(--st-primary); }

.clm-body {
    flex:1; overflow-y:auto; padding:16px 20px 24px;
    font-size:13px;
}
.clm-section { margin-top:18px; }
.clm-section:first-child { margin-top:0; }
.clm-section-h {
    font-size:11px; font-weight:600; color:var(--st-subtle);
    text-transform:uppercase; letter-spacing:0.06em;
    margin-bottom:8px;
}
.clm-empty {
    padding:16px; text-align:center;
    font-size:13px; color:var(--st-subtle);
    background:var(--st-bg); border-radius:8px;
}

/* Overview stats */
.clm-stat-grid {
    display:grid; grid-template-columns:repeat(3, 1fr); gap:8px;
    margin-bottom:4px;
}
.clm-stat {
    background:var(--st-bg); border:1px solid #F1F5F9;
    border-radius:10px; padding:10px 12px;
}
.clm-stat-lbl { font-size:11px; color:var(--st-muted); font-weight:500; }
.clm-stat-num {
    margin-top:4px; font-size:22px; font-weight:800;
    color:var(--st-text-strong); letter-spacing:-0.02em;
}
.clm-stat-text {
    margin-top:4px; font-size:12px; font-weight:600; color:var(--st-text);
}

.clm-contact { display:flex; flex-direction:column; gap:6px; }
.clm-contact-row { display:flex; gap:12px; font-size:13px; }
.clm-contact-lbl { width:90px; color:var(--st-muted); flex-shrink:0; }
.clm-contact-val { color:var(--st-text); font-weight:500; }

/* Plan week strip */
.clm-plan-grid {
    display:grid; grid-template-columns:repeat(7, 1fr); gap:4px;
}
.clm-plan-day {
    background:var(--st-bg); border:1px solid #F1F5F9;
    border-radius:8px; padding:6px 6px 8px;
    min-height:110px;
}
.clm-plan-day.today { background:var(--st-primary-light); border-color:var(--st-primary-border); }
.clm-plan-head { display:flex; flex-direction:column; align-items:flex-start; margin-bottom:6px; }
.clm-plan-head .dn {
    font-size:10px; color:var(--st-subtle); text-transform:uppercase;
    letter-spacing:0.04em; font-weight:600;
}
.clm-plan-head .dd {
    font-size:16px; font-weight:800; color:var(--st-text-strong);
}
.clm-plan-day.today .dd { color:var(--st-primary); }
.clm-plan-entries { display:flex; flex-direction:column; gap:4px; }
.clm-plan-entry {
    background:var(--st-white); border-radius:5px;
    padding:4px 6px; border-left:2px solid var(--st-primary);
}
.clm-ple-time { font-size:9px; color:var(--st-muted); font-weight:600; }
.clm-ple-label { font-size:11px; color:var(--st-text); font-weight:600; line-height:1.25; }
.clm-ple-who { font-size:10px; color:var(--st-subtle); }
.clm-plan-empty { font-size:11px; color:var(--st-border-hover); padding:0 4px; }

/* Tasks sub-tabs */
.clm-subtabs {
    display:inline-flex; gap:2px;
    background:#F1F5F9; border-radius:8px; padding:3px;
    margin-bottom:12px;
}
.clm-subtabs button {
    background:transparent; border:none;
    padding:6px 12px; font-size:12px; font-weight:600;
    color:var(--st-muted); cursor:pointer; border-radius:6px;
    font-family:inherit;
}
.clm-subtabs button.on {
    background:var(--st-white); color:var(--st-text);
    box-shadow:0 1px 2px rgba(15,23,42,0.06);
}

.clm-task-list { display:flex; flex-direction:column; gap:6px; }
.clm-task {
    background:var(--st-white); border:1px solid var(--st-border);
    border-radius:10px; padding:10px 12px;
    display:flex; gap:10px; align-items:flex-start;
}
.clm-task-main { flex:1; min-width:0; }
.clm-task-name { font-size:13px; font-weight:600; color:var(--st-text); line-height:1.3; }
.clm-task-meta { display:flex; gap:6px; align-items:center; font-size:11px; color:var(--st-muted); margin-top:4px; }

/* Quality */
.clm-quality { display:flex; flex-direction:column; gap:10px; }
.clm-q-row {
    display:flex; gap:12px; align-items:center;
    background:var(--st-white); border:1px solid var(--st-border);
    border-radius:10px; padding:12px;
}
.clm-q-score {
    width:44px; height:44px; border-radius:50%;
    display:flex; align-items:center; justify-content:center;
    font-size:13px; font-weight:800; color:var(--st-white);
    flex-shrink:0;
}
.clm-q-score.good { background:var(--st-success); }
.clm-q-score.med  { background:var(--st-warning); }
.clm-q-score.bad  { background:var(--st-error); }
.clm-q-score.unset { background:var(--st-border-hover); }
.clm-q-body { flex:1; min-width:0; }
.clm-q-auditor { font-size:13px; font-weight:700; color:var(--st-text-strong); }
.clm-q-when { font-size:11px; color:var(--st-muted); }
.clm-q-stats { display:flex; gap:10px; font-size:11px; color:var(--st-muted); margin-top:4px; }
.clm-q-note { font-size:12px; color:#475569; line-height:1.45; margin-top:4px; }

/* Activity */
.clm-activity { display:flex; flex-direction:column; gap:0; position:relative; }
.clm-act-row { display:flex; gap:12px; padding:8px 0; position:relative; }
.clm-act-row::before {
    content:""; position:absolute;
    left:4px; top:18px; bottom:-8px;
    width:1px; background:var(--st-border);
}
.clm-act-row:last-child::before { display:none; }
.clm-act-dot {
    width:9px; height:9px; border-radius:50%;
    background:var(--st-primary); margin-top:6px; flex-shrink:0;
    border:2px solid var(--st-white);
    box-shadow:0 0 0 1px var(--st-primary-border);
    z-index:1;
}
.clm-act-body { flex:1; }
.clm-act-what { font-size:12px; color:var(--st-text); line-height:1.4; }
.clm-act-when { font-size:11px; color:var(--st-subtle); margin-top:2px; }

/* Agreements */
.clm-agreements { display:flex; flex-direction:column; gap:8px; }
.clm-agr {
    background:var(--st-white); border:1px solid var(--st-border);
    border-left:3px solid var(--st-primary); border-radius:10px; padding:12px;
}
.clm-agr-name { font-size:13px; font-weight:700; color:var(--st-text); }
.clm-agr-meta { display:flex; gap:6px; font-size:11px; color:var(--st-muted); margin-top:4px; }
.clm-agr-value { font-size:12px; color:var(--st-primary); font-weight:600; margin-top:6px; }

/* Hover preview card */
.clm-hover {
    position:absolute; z-index:8;
    background:var(--st-white); border:1px solid var(--st-border);
    border-radius:10px; padding:10px 12px;
    box-shadow:0 8px 20px rgba(15,23,42,0.12);
    min-width:220px; pointer-events:none;
    transform:translate(-50%, -100%) translateY(-12px);
    font-size:12px;
}
.clm-hover-name {
    display:flex; align-items:center; gap:6px;
    font-size:13px; font-weight:700; color:var(--st-text-strong);
    margin-bottom:2px;
}
.clm-hover-name .dot { width:8px; height:8px; border-radius:50%; }
.clm-hover-addr { color:var(--st-muted); font-size:11px; margin-bottom:4px; }
.clm-hover-meta {
    display:flex; gap:6px; font-size:11px; color:var(--st-muted);
    border-top:1px solid #F1F5F9; padding-top:5px; margin-top:5px;
}

/* Legend — bottom-left */
.clm-legend {
    position:absolute; bottom:14px; left:14px; z-index:5;
    background:rgba(255,255,255,0.95); backdrop-filter:blur(8px);
    border:1px solid var(--st-border); border-radius:10px;
    padding:10px 12px; font-size:12px;
    box-shadow:0 4px 12px rgba(15,23,42,0.06); min-width:150px;
}
.clm-legend-h {
    font-size:10px; font-weight:600; color:var(--st-subtle);
    text-transform:uppercase; letter-spacing:0.06em;
    margin-bottom:6px;
}
.clm-legend-row {
    display:flex; align-items:center; gap:8px;
    padding:3px 0; color:#475569;
}
.clm-legend-row .dot { width:9px; height:9px; border-radius:50%; }

/* Location drawings thumbnails in the map detail panel */
.clm-drawing-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.clm-drawing {
    position: relative;
    display: block;
    height: 92px;
    border-radius: 8px;
    border: 1px solid var(--st-border);
    background: #F1F5F9 center / cover no-repeat;
    overflow: hidden;
    text-decoration: none;
    cursor: pointer;
}
.clm-drawing-noimg {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--st-border-hover);
}
.clm-drawing-name {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--st-white);
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Keep the Mapbox zoom (+/-) control clear of the floating filter bar (top:14px, ~62px tall) */
.clm-map-area .mapboxgl-ctrl-top-right { margin-top: 60px; }
