/* Analytics and Reports pages. Complements dotleads.css with the dl-an- and dl-rp- prefixes
   so nothing here can collide with the shared design system. */

/* ---------- filter row ---------- */

.dl-an-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 18px;
}

.dl-an-range { display: flex; gap: 12px; flex-wrap: wrap; }

.dl-an-field { display: flex; flex-direction: column; gap: 6px; }

.dl-an-field > label {
    font-family: var(--nav-font);
    font-size: .74rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-faint);
}

.dl-an-field .dl-input,
.dl-an-field .dl-select { width: auto; min-width: 160px; padding: 9px 12px; font-size: .86rem; }

/* Combobox-wrapped inputs keep room for the chevron/clear buttons: the compact
   padding above is more specific than the component's own right-padding rule. */
.dl-an-field .dl-cbx > .dl-input { width: 100%; padding-right: 40px; }
.dl-an-field .dl-cbx { min-width: 180px; }

.dl-an-filteractions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* ---------- headline metrics ---------- */

/* The booked-value tile carries a currency code, so it needs room to breathe. */
.dl-an-money { font-size: 1.35rem; word-break: break-word; }

.dl-an-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.dl-an-metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid var(--hairline);
    border-radius: 12px;
    background: var(--hover-bg);
}

.dl-an-metric .lbl {
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-faint);
}

.dl-an-metric .val {
    font-family: var(--nav-font);
    font-variant-numeric: tabular-nums;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-strong);
}

/* ---------- charts ---------- */

.dl-an-cardhead {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

/* Sized to include the x-axis band so a card never grows its own scrollbar. */
.dl-an-chart {
    min-height: 320px;
    margin-top: 10px;
    transition: opacity .18s ease;
}

/* Refetch holds the previous render at reduced opacity instead of flashing a skeleton. */
.dl-an-busy .dl-an-chart,
.dl-an-busy .dl-an-metrics,
.dl-an-busy .dl-stat { opacity: .45; }

.dl-an-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 34px 12px;
    color: var(--text-muted);
    font-size: .88rem;
}

.dl-an-tablewrap { overflow-x: auto; }

.dl-an-name { color: var(--text-strong); font-weight: 600; }

/* ---------- reports: picker ---------- */

.dl-rp-picker { position: sticky; top: 12px; }

.dl-rp-option {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: 1px solid var(--hairline);
    border-radius: 12px;
    padding: 11px 13px;
    margin-top: 8px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.dl-rp-option:hover { border-color: var(--emerald); }

.dl-rp-option.active {
    border-color: var(--emerald);
    background: rgba(34, 197, 94, .08);
}

.dl-rp-option .nm {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--nav-font);
    font-size: .88rem;
    font-weight: 600;
    color: var(--text-strong);
}

.dl-rp-option .nm i { color: var(--emerald); }

.dl-rp-option .ds {
    display: block;
    font-size: .78rem;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.45;
}

/* ---------- reports: filters and actions ---------- */

.dl-rp-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 16px;
    margin-top: 14px;
}

.dl-rp-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--hairline);
}

/* ---------- reports: results ---------- */

.dl-rp-resulthead {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.dl-rp-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 14px;
    border-left: 3px solid var(--emerald);
    border-radius: 10px;
    background: var(--hover-bg);
}

.dl-rp-summary .cell { display: flex; flex-direction: column; gap: 3px; }

.dl-rp-summary .lbl {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-faint);
}

.dl-rp-summary .val {
    font-family: var(--nav-font);
    font-variant-numeric: tabular-nums;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-strong);
}

.dl-rp-num { text-align: right; }

@media (max-width: 991px) {
    .dl-rp-picker { position: static; }
    .dl-an-filteractions { margin-left: 0; }
}
