/* ==================================================================================================
   "I HAVE A BUYER"

   The dialog on a listing page, and the enquiries inbox. Its own file rather than more of
   listing-delete.css: this is a distinct feature with a dialog, an inbox and a set of status
   chips, and it should be removable in one line if it is ever withdrawn.
   ================================================================================================== */

.wr-ihb-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1180;
    background: rgba(13, 26, 53, .5);
}

.wr-ihb {
    position: fixed;
    z-index: 1190;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    width: min(560px, calc(100vw - 32px));
    max-height: min(86vh, 760px);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .3);
    overflow: hidden;
}

.wr-ihb > header,
.wr-ihb > footer {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1rem 1.25rem;
    background: #f8fafc;
}

.wr-ihb > header { border-bottom: 1px solid #e2e8f0; }
.wr-ihb > footer { border-top: 1px solid #e2e8f0; justify-content: flex-end; }

.wr-ihb h2 {
    flex: 1 1 auto;
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
}

.wr-ihb-x {
    width: 2rem;
    height: 2rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: #475569;
    cursor: pointer;
}

.wr-ihb-x:hover { background: #f1f5f9; }
.wr-ihb-x:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }

.wr-ihb-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 1.15rem 1.25rem;
}

.wr-ihb-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: .7rem 1.25rem;
    margin: 0 0 1.1rem;
    padding: .9rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
}

.wr-ihb-facts dt {
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: #64748b;
}

.wr-ihb-facts dd {
    margin: .1rem 0 0;
    font-size: .92rem;
    color: #0f172a;
}

.wr-ihb-label {
    display: block;
    margin-bottom: .35rem;
    font-size: .85rem;
    font-weight: 600;
    color: #334155;
}

.wr-ihb-error {
    margin: .6rem 0 0;
    padding: .55rem .8rem;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    background: #fef2f2;
    color: #b91c1c;
    font-size: .86rem;
}

.wr-ihb-note {
    display: flex;
    align-items: flex-start;
    gap: .45rem;
    margin: .85rem 0 0;
    font-size: .8rem;
    line-height: 1.5;
    color: #64748b;
}

.wr-ihb-done {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    padding: 1.5rem 0;
    text-align: center;
}

.wr-ihb-done i {
    font-size: 2.4rem;
    color: #16a34a;
}

.wr-ihb-done h3 { margin: .3rem 0 0; font-size: 1.05rem; color: #0f172a; }
.wr-ihb-done p { margin: 0 0 .6rem; color: #475569; font-size: .92rem; }

/* ---- the enquiries inbox ---- */

.wr-inq-list { display: flex; flex-direction: column; gap: .75rem; }

.wr-inq {
    display: flex;
    flex-direction: column;
    gap: .45rem;
    padding: 1rem 1.15rem;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
}

/* An unopened lead is the one thing on this page that must not be missed. */
.wr-inq.is-unread { border-left-color: #2563eb; background: #f8fbff; }

.wr-inq-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
}

.wr-inq-agent { font-size: 1rem; font-weight: 700; color: #0f172a; }
.wr-inq-when { font-size: .78rem; color: #64748b; font-variant-numeric: tabular-nums; }

.wr-inq-property {
    font-size: .88rem;
    color: #475569;
}

.wr-inq-message {
    margin: .2rem 0 0;
    padding: .6rem .8rem;
    border-radius: 8px;
    background: #f8fafc;
    font-size: .9rem;
    line-height: 1.55;
    color: #334155;
    white-space: pre-wrap;
}

.wr-inq-foot {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    margin-top: .3rem;
}

.wr-inq-status {
    display: inline-flex;
    padding: .1rem .5rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.wr-inq-status.is-new { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }

@media (max-width: 575.98px) {
    .wr-ihb { max-height: calc(100vh - 24px); }
    .wr-ihb > footer { flex-direction: column-reverse; }
    .wr-ihb > footer .wr-btn { width: 100%; }
}

/* The unread count on the Received tab. Not in app-shell.css because no other tab strip in this
   application carries a count — adding it there would be a shared style with one caller. */
.wr-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    margin-left: .4rem;
    padding: 0 .35rem;
    border-radius: 999px;
    background: #2563eb;
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    vertical-align: middle;
}

/* ==================================================================================================
   ADMIN → LISTING SUBMISSIONS
   ================================================================================================== */

.wr-subm__cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: .85rem;
    margin: 0 0 1.25rem;
}

.wr-subm__card {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    padding: 1rem 1.15rem;
    border: 1px solid #e2e8f0;
    border-top: 3px solid #94a3b8;
    border-radius: 12px;
    background: #fff;
}

.wr-subm__card.is-ok   { border-top-color: #16a34a; }
.wr-subm__card.is-warn { border-top-color: #d97706; }
.wr-subm__card.is-bad  { border-top-color: #dc2626; }

.wr-subm__num {
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.1;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}

.wr-subm__lbl {
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #475569;
}

.wr-subm__filters {
    display: flex;
    flex-wrap: wrap;
    gap: .85rem;
    margin-bottom: 1rem;
}

.wr-subm__sub {
    display: block;
    font-size: .76rem;
    line-height: 1.4;
    color: #64748b;
}

.wr-subm__muted { color: #94a3b8; }

.wr-subm__file {
    display: inline-block;
    max-width: 22ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
    font-size: .86rem;
}

.wr-subm__pill {
    display: inline-flex;
    padding: .1rem .5rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.wr-subm__pill.is-ok     { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.wr-subm__pill.is-warn   { background: #fffbeb; color: #b45309; border-color: #fcd34d; }
.wr-subm__pill.is-bad    { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.wr-subm__pill.is-muted  { background: #f8fafc; color: #94a3b8; }

.wr-subm__json {
    padding: 1rem 1.15rem;
    background: #f8fafc;
    border-radius: 10px;
}

.wr-subm__json h4 {
    margin: 0 0 .3rem;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #475569;
}

.wr-subm__json pre {
    margin: .5rem 0 0;
    padding: .8rem;
    max-height: 340px;
    overflow: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    font-size: .78rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}
