/* ============================================
   CRM PIPELINE BOARD (GEN-05B2A)
   Default styling for the canonical js/components/crm-pipeline-board.js
   component when rendered with a consumer's classPrefix. Real Estate's
   Reporting consumer passes classPrefix 'reporting', so every selector
   below is the exact `.reporting-*` class family the pre-extraction
   reporting.css defined -- moved here verbatim (same values) so the
   Real Estate Reporting page renders pixel-identical to before. A future
   General consumer (GEN-05B2B) passes its own classPrefix and its own
   small stylesheet of the same shape, reusing this file's layout/values
   rather than re-copying them under a different prefix.
   Bare class selectors (no page-root scoping), matching coordy-ui.css's
   own convention -- confirmed zero collision with any other surface.
   ============================================ */

/* ── Toolbar (pipeline selector + view toggle + actions) ────────────── */
.reporting-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 12px;
    border: 1px solid rgba(132, 150, 188, 0.2);
    border-radius: 8px;
    background: rgba(29, 33, 43, 0.92);
}

.reporting-toolbar label,
.reporting-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: rgba(244, 247, 255, 0.74);
    font-size: 0.78rem;
    font-weight: 800;
}

.reporting-toolbar select,
.reporting-form input,
.reporting-form select {
    min-height: 38px;
    border: 1px solid rgba(132, 150, 188, 0.28);
    border-radius: 7px;
    background: rgba(11, 14, 21, 0.72);
    color: #f8fbff;
    padding: 0 11px;
    font: inherit;
}

.reporting-toolbar select {
    min-width: 220px;
}

.reporting-form input:focus,
.reporting-form select:focus,
.reporting-toolbar select:focus {
    border-color: rgba(125, 150, 255, 0.75);
    box-shadow: 0 0 0 3px rgba(104, 126, 235, 0.18);
    outline: none;
}

.reporting-segmented {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid rgba(132, 150, 188, 0.2);
    border-radius: 8px;
    background: rgba(8, 11, 17, 0.45);
}

.reporting-segmented button {
    min-height: 30px;
    padding: 0 12px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: rgba(244, 247, 255, 0.7);
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    font: inherit;
}

.reporting-segmented button.active {
    color: #ffffff;
    background: rgba(102, 126, 234, 0.86);
}

/* ── Board / stage columns / deal cards ──────────────────────────────── */
/* Stages sit in ONE row that scrolls horizontally on its own (never wraps onto extra rows and never
   makes the page scroll sideways), so a pipeline with many stages stays compact. */
.reporting-board {
    display: flex;
    flex-wrap: nowrap;
    gap: 14px;
    align-items: flex-start;
    overflow-x: auto;
    padding-bottom: 10px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    scrollbar-color: rgba(143, 164, 255, 0.45) rgba(8, 11, 17, 0.45);
}

.reporting-board::-webkit-scrollbar { height: 10px; }
.reporting-board::-webkit-scrollbar-track { background: rgba(8, 11, 17, 0.45); border-radius: 8px; }
.reporting-board::-webkit-scrollbar-thumb { background: rgba(143, 164, 255, 0.45); border-radius: 8px; }

.reporting-kpi-card,
.reporting-card,
.reporting-stage-column,
.reporting-manager-card {
    border: 1px solid rgba(128, 146, 184, 0.23);
    border-radius: 8px;
    background: rgba(38, 42, 53, 0.94);
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.22);
}

.reporting-card {
    padding: 18px;
}

.reporting-card-full {
    grid-column: 1 / -1;
}

.reporting-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.reporting-card-header h3,
.reporting-card-header h4 {
    margin: 0;
    color: #ffffff;
    font-size: 1.05rem;
    line-height: 1.2;
    letter-spacing: 0;
}

.reporting-card-header p {
    margin-bottom: 4px;
}

.reporting-stage-column {
    flex: 0 0 300px;
    min-width: 280px;
    min-height: 260px;
    padding: 14px;
    scroll-snap-align: start;
}

.reporting-stage-column header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 10px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(132, 150, 188, 0.18);
}

.reporting-stage-column header h3 {
    margin: 0 0 4px;
    color: #ffffff;
    font-size: 0.95rem;
}

.reporting-stage-column header em {
    color: #a8c4ff;
    font-style: normal;
    font-size: 0.82rem;
    font-weight: 850;
    white-space: nowrap;
}

.reporting-stage-column header span {
    color: rgba(244, 247, 255, 0.62);
    font-size: 0.78rem;
}

/* A column shows about four deal cards (119px each + 9px gaps), then scrolls on its own instead of
   growing the page. */
.reporting-stage-cards {
    display: flex;
    flex-direction: column;
    gap: 9px;
    max-height: 506px;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(143, 164, 255, 0.45) transparent;
}

.reporting-stage-cards::-webkit-scrollbar { width: 8px; }
.reporting-stage-cards::-webkit-scrollbar-thumb { background: rgba(143, 164, 255, 0.45); border-radius: 8px; }

.reporting-list-row,
.reporting-deal-card {
    width: 100%;
    border: 1px solid rgba(132, 150, 188, 0.18);
    border-radius: 8px;
    background: rgba(18, 21, 29, 0.58);
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.reporting-list-row:hover,
.reporting-deal-card:hover {
    border-color: rgba(143, 164, 255, 0.48);
    background: rgba(31, 36, 49, 0.92);
}

.reporting-deal-card {
    padding: 12px;
}

.reporting-deal-card h4,
.reporting-deal-card p {
    margin: 0;
}

.reporting-deal-card h4 {
    color: #ffffff;
    font-size: 0.92rem;
    line-height: 1.25;
}

.reporting-deal-card p {
    margin-top: 4px;
    color: #a8c4ff;
    font-size: 0.86rem;
    font-weight: 850;
}

.reporting-deal-card span {
    color: rgba(244, 247, 255, 0.62);
    font-size: 0.78rem;
    font-style: normal;
}

.reporting-deal-card select {
    width: 100%;
    min-height: 32px;
    margin-top: 10px;
    border: 1px solid rgba(132, 150, 188, 0.24);
    border-radius: 6px;
    background: rgba(8, 11, 17, 0.72);
    color: #f8fbff;
    padding: 0 8px;
}

.reporting-deal-card-actions {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(132, 150, 188, 0.15);
    display: flex;
    justify-content: flex-end;
}

/* ── Generic buttons / icon buttons ──────────────────────────────────── */
.reporting-btn,
.reporting-icon-btn,
.reporting-list-row,
.reporting-deal-card,
.reporting-segmented button {
    font: inherit;
}

.reporting-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 7px;
    font-size: 0.86rem;
    font-weight: 850;
    letter-spacing: 0;
    cursor: pointer;
}

.reporting-btn-primary {
    color: #ffffff;
    background: #667eea;
    box-shadow: 0 9px 18px rgba(77, 99, 210, 0.22);
}

.reporting-btn-primary:hover,
.reporting-btn-primary:focus-visible {
    background: #728aff;
    outline: none;
}

.reporting-btn-secondary {
    color: rgba(244, 247, 255, 0.88);
    border-color: rgba(132, 150, 188, 0.28);
    background: rgba(255, 255, 255, 0.06);
}

.reporting-btn-secondary:hover,
.reporting-btn-secondary:focus-visible {
    color: #ffffff;
    border-color: rgba(150, 169, 255, 0.55);
    outline: none;
}

.reporting-btn-sm {
    min-height: 28px;
    padding: 0 10px;
    font-size: 0.78rem;
}

.reporting-btn-danger {
    color: #ffffff;
    background: #e5484d;
    box-shadow: 0 9px 18px rgba(229, 72, 77, 0.28);
}

.reporting-btn-danger:hover,
.reporting-btn-danger:focus-visible {
    background: #f2555a;
    outline: none;
}

.reporting-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(132, 150, 188, 0.22);
    border-radius: 7px;
    color: rgba(244, 247, 255, 0.8);
    background: rgba(255, 255, 255, 0.055);
    cursor: pointer;
}

.reporting-icon-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.reporting-icon-btn-danger {
    color: #ff6b6b;
    border-color: rgba(255, 107, 107, 0.3);
}

.reporting-icon-btn-danger:hover {
    background: rgba(255, 107, 107, 0.1);
}

/* ── Drawer / modal shell (deal drawer + pipeline manager drawer) ────── */
.reporting-modal {
    position: fixed;
    inset: 0;
    z-index: 1000000;
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
    padding: 18px;
    background: rgba(3, 6, 12, 0.62);
}

.reporting-modal.hidden {
    display: none;
}

/* The prompt modal (replaces window.prompt()/window.confirm()) is triggered
   from inside the already-open Pipeline Manager drawer, so it must stack
   above it as a real centered dialog rather than another right-edge
   slide-in panel -- same overlay/backdrop mechanics, different placement
   and a higher z-index. */
.reporting-modal-nested {
    z-index: 1000010;
    align-items: center;
    justify-content: center;
}

.reporting-prompt-drawer {
    width: min(420px, 100%);
}

.reporting-drawer {
    width: min(460px, 100%);
    overflow-y: auto;
    border: 1px solid rgba(132, 150, 188, 0.28);
    border-radius: 8px;
    background: #242936;
    box-shadow: -24px 0 46px rgba(0, 0, 0, 0.32);
}

.reporting-drawer-wide {
    width: min(760px, 100%);
}

.reporting-drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 20px 12px;
    border-bottom: 1px solid rgba(132, 150, 188, 0.16);
}

.reporting-drawer-header h3 {
    margin: 0;
    color: #ffffff;
    font-size: 1.16rem;
    letter-spacing: 0;
}

.reporting-drawer-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.reporting-form {
    display: grid;
    gap: 13px;
    padding: 18px 20px 20px;
}

.reporting-field-error {
    margin-top: 6px;
    color: #ff6b6b;
    font-size: 0.78rem;
    font-weight: 700;
}

.reporting-form input[aria-invalid="true"] {
    border-color: #ff6b6b;
}

.reporting-pipeline-manager-body {
    padding: 18px 20px 20px;
}

/* ── Pipeline Manager ─────────────────────────────────────────────────── */
.reporting-manager-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.reporting-manager-card {
    padding: 16px;
}

.reporting-manager-stages {
    display: grid;
    gap: 8px;
}

.reporting-manager-stage {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(132, 150, 188, 0.14);
    border-radius: 7px;
    background: rgba(13, 16, 24, 0.55);
}

.reporting-manager-stage span {
    color: #ffffff;
    font-size: 0.88rem;
    font-weight: 750;
}

.reporting-manager-stage em {
    color: rgba(244, 247, 255, 0.62);
    font-size: 0.78rem;
    font-style: normal;
}

.reporting-manager-stage-info {
    display: flex;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.reporting-manager-stage-input,
.reporting-manager-stage-select {
    min-height: 32px;
    border: 1px solid rgba(132, 150, 188, 0.28);
    border-radius: 6px;
    background: rgba(11, 14, 21, 0.72);
    color: #f8fbff;
    padding: 0 11px;
    font: inherit;
    font-size: 0.85rem;
}

/* The label input must take the lion's share of the row and the outcome
   select a fixed, legible width -- without an explicit basis on both,
   the select's content-based auto width (driven by its longest option,
   "Won / Closed") can win most of the row's space while flex:1 alone
   leaves the input with only whatever is left over. */
.reporting-manager-stage-input {
    flex: 1 1 0%;
    min-width: 0;
}

.reporting-manager-stage-select {
    flex: 0 0 136px;
    min-width: 0;
}

/* The app-wide custom-select replacement (frontend/js/core/state.js
   autoCustomSelect) runs on every <select> including this one: it hides
   the real element and inserts a sibling ".csr-wrapper" button in its
   place, so the row's actual second flex item at runtime is the
   wrapper, not .reporting-manager-stage-select. The wrapper's own
   default (width: 100%, base.css) otherwise claims most of the row and
   collapses the label input -- pin it to the same fixed width here. */
.reporting-manager-stage-info > .csr-wrapper {
    flex: 0 0 136px;
    width: auto;
    min-width: 0;
}

.reporting-manager-stage-actions {
    display: flex;
    gap: 6px;
}

.reporting-manager-note {
    margin: 12px 0 0;
    color: rgba(244, 247, 255, 0.58);
    font-size: 0.82rem;
    line-height: 1.45;
}

/* ── Generic table (used by board list-view and by any consumer tab) ── */
.reporting-table-shell {
    overflow-x: auto;
    border: 1px solid rgba(132, 150, 188, 0.16);
    border-radius: 8px;
}

.reporting-table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
}

.reporting-table th,
.reporting-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(132, 150, 188, 0.14);
    color: rgba(244, 247, 255, 0.72);
    text-align: left;
    font-size: 0.86rem;
}

.reporting-table th {
    color: rgba(244, 247, 255, 0.54);
    background: rgba(255, 255, 255, 0.035);
    font-size: 0.74rem;
    font-weight: 850;
    text-transform: uppercase;
}

.reporting-table tr:last-child td {
    border-bottom: 0;
}

.reporting-table tbody tr {
    cursor: pointer;
}

.reporting-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.045);
}

.reporting-table strong {
    color: #ffffff;
}

/* ── Generic empty state / skeleton ──────────────────────────────────── */
.reporting-empty-state {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px;
    border: 1px dashed rgba(142, 160, 198, 0.28);
    border-radius: 8px;
    background: rgba(17, 21, 31, 0.58);
}

.reporting-empty-state-compact {
    padding: 14px;
}

.reporting-empty-state strong {
    display: block;
    color: #ffffff;
    font-size: 0.98rem;
}

.reporting-empty-state p {
    margin: 5px 0 12px;
    color: rgba(244, 247, 255, 0.64);
    font-size: 0.86rem;
    line-height: 1.45;
}

.reporting-kpi-icon,
.reporting-empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: #ffffff;
    background: rgba(118, 141, 255, 0.24);
    font-size: 0.78rem;
    font-weight: 850;
}

.reporting-skeleton-grid span,
.reporting-skeleton-wide {
    display: block;
    border-radius: 8px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
    background-size: 220% 100%;
    animation: reporting-shimmer 1.2s linear infinite;
}

.reporting-skeleton-grid span {
    min-height: 138px;
}

.reporting-skeleton-wide {
    min-height: 280px;
}

@keyframes reporting-shimmer {
    from {
        background-position: 120% 0;
    }

    to {
        background-position: -120% 0;
    }
}

/* ── Generic eyebrow label (used by drawer/manager headers too) ─────── */
.reporting-eyebrow {
    margin: 0 0 5px;
    color: #a8c4ff;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

/* ── Select arrow (generic form control affordance) ──────────────────── */
.reporting-toolbar select,
.reporting-form select,
.reporting-manager-stage-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23a8c4ff%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat, repeat;
    background-position: right .7em top 50%, 0 0;
    background-size: .65em auto, 100%;
    padding-right: 2em !important;
}

/* ── Responsive (board region scrolls horizontally on its own; no
   whole-page overflow) — covers 1440/1280 (no override needed, grid
   auto-fit already adapts), 980/768 breakpoint, and 640/430/390 breakpoint. */
@media (max-width: 980px) {
    /* the horizontal-scrolling board is the default at every width (see .reporting-board) */
    .reporting-stage-column {
        flex-basis: 280px;
    }
}

@media (max-width: 640px) {
    .reporting-btn,
    .reporting-toolbar label,
    .reporting-toolbar select {
        width: 100%;
    }

    .reporting-toolbar,
    .reporting-drawer-actions {
        width: 100%;
    }

    .reporting-list-row,
    .reporting-manager-stage {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
    }

    .reporting-manager-stage-info {
        flex-direction: column;
    }

    .reporting-manager-stage-select {
        flex-basis: auto;
    }

    .reporting-manager-stage-info > .csr-wrapper {
        flex-basis: auto;
        width: 100%;
    }

    .reporting-modal {
        padding: 8px;
    }

    .reporting-drawer,
    .reporting-drawer-wide {
        width: 100%;
    }
}

/* ── PLAN-ENTITLEMENTS-01A: multi-pipeline toolbar, plan usage, New Pipeline flow, manager ───────────
   The board/stage-column/KPI layout rules above are untouched; everything here only affects the toolbar row and the
   dialogs, and wraps instead of overflowing at every width. */
.reporting-toolbar-group {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
}

.reporting-toolbar-actions {
    margin-left: auto;
    align-items: center;
}

.reporting-plan-usage {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid rgba(132, 150, 188, 0.24);
    border-radius: 999px;
    background: rgba(8, 11, 17, 0.45);
    color: rgba(244, 247, 255, 0.78);
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
}

.reporting-plan-usage[data-state="full"] {
    border-color: rgba(255, 196, 92, 0.55);
    background: rgba(255, 196, 92, 0.1);
    color: #ffd98a;
}

.reporting-plan-usage[data-state="unlimited"] {
    border-color: rgba(120, 214, 170, 0.34);
    color: #a8ebcb;
}

/* At the plan limit the button stays visible (never disappears) and opens the upgrade state. */
.reporting-btn-newpipeline {
    gap: 7px;
}

.reporting-btn-newpipeline.is-limit,
.reporting-btn-limit {
    border-style: dashed;
    border-color: rgba(255, 196, 92, 0.6);
    color: #ffd98a;
}

.reporting-newpipeline-drawer .reporting-form {
    padding-top: 14px;
}

.reporting-notice-body {
    padding: 16px 20px 6px;
}

.reporting-notice-body .coordy-plan-upgrade {
    margin: 0;
}

.reporting-notice-actions {
    padding: 8px 20px 20px;
}

.reporting-manager-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.reporting-manager-meta {
    margin: 4px 0 0;
    color: rgba(244, 247, 255, 0.55);
    font-size: 0.78rem;
}

.reporting-manager-card .reporting-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.reporting-manager-card .reporting-card-header h4 {
    margin: 0;
    color: #ffffff;
    font-size: 1rem;
    overflow-wrap: anywhere;
}

.reporting-manager-pipeline-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.reporting-manager-lock {
    margin-bottom: 10px;
}

.reporting-manager-lock .coordy-plan-upgrade {
    margin: 0;
}

.reporting-manager-stage-readonly {
    opacity: 0.92;
}

.reporting-manager-archived {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid rgba(132, 150, 188, 0.16);
}

.reporting-manager-archived-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
    padding: 10px 12px;
    border: 1px solid rgba(132, 150, 188, 0.14);
    border-radius: 7px;
    background: rgba(13, 16, 24, 0.55);
}

.reporting-manager-archived-row strong {
    display: block;
    color: #ffffff;
    font-size: 0.88rem;
}

.reporting-manager-archived-row span {
    color: rgba(244, 247, 255, 0.6);
    font-size: 0.78rem;
}

@media (max-width: 980px) {
    .reporting-toolbar-actions {
        margin-left: 0;
    }
}

@media (max-width: 640px) {
    .reporting-toolbar-group {
        width: 100%;
    }

    .reporting-plan-usage {
        width: 100%;
        justify-content: center;
    }

    .reporting-manager-pipeline-actions {
        justify-content: flex-start;
    }

    .reporting-manager-archived-row {
        flex-direction: column;
        align-items: stretch;
    }
}
