/* =====================================================================
   Portal / app styles — additive layer on top of style.css.
   Reuses the existing design tokens (--primary, --gray-*, --radius, …)
   and the .dashboard / .sidebar / .main-content / .stat-card shell.
   ===================================================================== */

/* ---- Sidebar extras ---- */
.sidebar-logo {
    display: block;
    margin-bottom: 2rem;
    padding: 0 0.25rem;
}
.sidebar-logo-img {
    display: block;
    width: 100%;
    max-width: 210px;
    height: auto;
    border-radius: 10px;
}
.sidebar-role {
    padding: 0 1.5rem 1rem;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gray-400);
    font-weight: 700;
}
.sidebar-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0.75rem 1.25rem;
    list-style: none;
}

/* ---- Staff session timer chip ---- */
.staff-timer {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    background: rgba(14, 165, 233, 0.1);
    color: var(--primary);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-size: 0.85rem;
}

/* ---- Top bar ---- */
.portal-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--gray-200, #e5e7eb);
}
.portal-topbar-title h1 {
    font-size: 1.5rem;
    margin: 0;
}
.portal-topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.portal-bell {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: var(--radius, 12px);
    background: var(--white, #fff);
    box-shadow: var(--shadow, 0 1px 3px rgba(0,0,0,.1));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-600, #4b5563);
}
.portal-bell-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    background: var(--accent, #f59e0b);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.portal-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
    color: var(--dark, #0f172a);
}
.portal-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--gradient-primary, linear-gradient(135deg, #0ea5e9, #10b981));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* ---- Generic card ---- */
.section-card {
    background: var(--white, #fff);
    border-radius: var(--radius, 12px);
    box-shadow: var(--shadow, 0 1px 3px rgba(0,0,0,.1));
    overflow: hidden;
    margin-bottom: 1.5rem;
}
.section-card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-100, #f3f4f6);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.section-card-header h3 { font-size: 1.05rem; margin: 0; }
.section-card-body { padding: 1.5rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
@media (max-width: 992px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ---- Price breakdown (booking + funnel) ---- */
.price-breakdown {
    background: var(--gray-50, #f9fafb);
    border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: var(--radius, 12px);
    padding: 1.25rem 1.5rem;
}
.price-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    color: var(--gray-600, #4b5563);
}
.price-row.price-total {
    border-top: 2px solid var(--gray-200, #e5e7eb);
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--dark, #0f172a);
}
.price-row.price-muted { font-size: 0.85rem; color: var(--gray-400, #9ca3af); }

/* ---- Plan cards ---- */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem; }
.plan-card {
    border: 2px solid var(--gray-200, #e5e7eb);
    border-radius: var(--radius-lg, 20px);
    padding: 2rem;
    background: #fff;
    cursor: pointer;
    transition: all .2s ease;
    position: relative;
}
.plan-card:hover { border-color: var(--primary-light, #7dd3fc); transform: translateY(-3px); }
.plan-card.selected { border-color: var(--primary, #0ea5e9); box-shadow: var(--shadow-glow, 0 0 40px -10px rgba(14,165,233,.3)); }
.plan-card .plan-price { font-size: 2.25rem; font-weight: 800; color: var(--dark, #0f172a); }
.plan-card .plan-price span { font-size: 1rem; font-weight: 500; color: var(--gray-500, #6b7280); }
.plan-card ul { list-style: none; padding: 0; margin: 1rem 0 0; }
.plan-card li { padding: 0.35rem 0; color: var(--gray-600, #4b5563); }
.plan-card li i { color: var(--secondary, #10b981); margin-right: 0.5rem; }

/* ---- Multi-step funnel ---- */
.funnel-steps { display: flex; gap: 0.5rem; margin-bottom: 2rem; flex-wrap: wrap; }
.funnel-step {
    flex: 1;
    min-width: 90px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--gray-400, #9ca3af);
    border-top: 3px solid var(--gray-200, #e5e7eb);
    padding-top: 0.6rem;
    font-weight: 600;
}
.funnel-step.active { color: var(--primary, #0ea5e9); border-top-color: var(--primary, #0ea5e9); }
.funnel-step.done { color: var(--secondary, #10b981); border-top-color: var(--secondary, #10b981); }

/* ---- CRM timeline ---- */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline-item {
    position: relative;
    padding: 0 0 1.25rem 1.75rem;
    border-left: 2px solid var(--gray-200, #e5e7eb);
}
.timeline-item:last-child { border-left-color: transparent; }
.timeline-item::before {
    content: "";
    position: absolute;
    left: -7px;
    top: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary, #0ea5e9);
}
.timeline-item.channel-note::before { background: var(--accent, #f59e0b); }
.timeline-item.channel-call::before { background: var(--secondary, #10b981); }
.timeline-meta { font-size: 0.78rem; color: var(--gray-400, #9ca3af); }
.timeline-subject { font-weight: 700; }

/* ---- Coverage / area pill (homepage ZIP) ---- */
.area-result {
    margin-top: 1rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius, 12px);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    display: none;
}
.area-result.show { display: block; }
.area-result strong { color: #fff; }

/* ---- Status badges (extend style.css badges if absent) ---- */
.badge-soft { padding: 0.25rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700; }
.badge-soft.s-new, .badge-soft.s-pending, .badge-soft.s-open { background: #fef3c7; color: #92400e; }
.badge-soft.s-active, .badge-soft.s-confirmed, .badge-soft.s-paid, .badge-soft.s-approved, .badge-soft.s-completed, .badge-soft.s-converted, .badge-soft.s-resolved { background: #d1fae5; color: #065f46; }
.badge-soft.s-canceled, .badge-soft.s-cancelled, .badge-soft.s-failed, .badge-soft.s-rejected, .badge-soft.s-lost, .badge-soft.s-past_due { background: #fee2e2; color: #991b1b; }
.badge-soft.s-in_progress, .badge-soft.s-contacted, .badge-soft.s-qualified { background: #dbeafe; color: #1e40af; }

/* ---- Dashboard hero ---- */
.dash-hero {
    background: var(--gradient-hero, linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0ea5e9 100%));
    color: #fff;
    border-radius: 18px;
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.dash-hero h1 { margin: 0; font-size: 1.5rem; }
.dash-hero p { margin: .3rem 0 0; color: rgba(255, 255, 255, .82); }
.dash-hero .dash-hero-actions { display: flex; gap: .6rem; flex-wrap: wrap; }

/* ---- KPI cards (sparkline + delta) ---- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 1.25rem; margin-bottom: 1.5rem; }
.kpi-card {
    background: #fff;
    border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: 16px;
    padding: 1.2rem 1.35rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow, 0 1px 3px rgba(0,0,0,.08));
}
.kpi-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent-color, #0ea5e9); }
.kpi-top { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.kpi-icon { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; color: #fff; background: var(--accent-color, #0ea5e9); }
.kpi-value { font-size: 1.7rem; font-weight: 800; color: var(--dark, #0f172a); margin-top: .55rem; line-height: 1.1; }
.kpi-label { color: var(--gray-500, #6b7280); font-size: .84rem; }
.kpi-delta { font-size: .76rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px; white-space: nowrap; }
.kpi-delta.up { background: #d1fae5; color: #065f46; }
.kpi-delta.down { background: #fee2e2; color: #991b1b; }
.kpi-delta.flat { background: var(--gray-100, #f3f4f6); color: var(--gray-500, #6b7280); }
.kpi-spark { height: 38px; margin-top: .5rem; }

/* ---- Leaderboard ---- */
.leaderboard-row { display: flex; align-items: center; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--gray-100, #f3f4f6); }
.leaderboard-row:last-child { border-bottom: none; }
.rank-badge { width: 28px; height: 28px; border-radius: 50%; background: var(--gray-100, #f3f4f6); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .82rem; color: var(--gray-600, #4b5563); flex: 0 0 auto; }
.rank-badge.gold { background: #fef3c7; color: #92400e; }
.rank-badge.silver { background: #e5e7eb; color: #374151; }
.rank-badge.bronze { background: #fde6d2; color: #9a3412; }
.lb-name { flex: 1; min-width: 0; }
.lb-name strong { display: block; }
.lb-name span { color: var(--gray-400, #9ca3af); font-size: .78rem; }
.lb-earn { font-weight: 700; color: var(--dark, #0f172a); }

/* ---- Activity feed ---- */
.activity-item { display: flex; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--gray-100, #f3f4f6); font-size: .88rem; align-items: flex-start; }
.activity-item:last-child { border-bottom: none; }
.activity-ic { width: 30px; height: 30px; border-radius: 8px; background: var(--gray-100, #f3f4f6); display: flex; align-items: center; justify-content: center; color: var(--primary, #0ea5e9); flex: 0 0 auto; }
.activity-meta { color: var(--gray-400, #9ca3af); font-size: .76rem; }

/* ---- Impersonation bar ---- */
.impersonation-bar {
    position: sticky;
    top: 0;
    z-index: 1200;
    background: #f59e0b;
    color: #1f2937;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.6rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.impersonation-bar a {
    color: #1f2937;
    text-decoration: underline;
    white-space: nowrap;
}

/* ---- Responsive sidebar toggle ---- */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1100;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: var(--radius, 12px);
    background: var(--dark, #0f172a);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
}
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1040;
}
/* Portal body container */
.portal-body {
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

@media (max-width: 992px) {
    .sidebar-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        transform: translateX(-100%);
        transition: transform .25s ease;
        z-index: 1050;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop.show { display: block; }
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding-top: 4.5rem;
    }
}

/* =====================================================================
   Marketplace "Uber-style" components (v3): cleaner picker, offers,
   online toggle, live status tracker, message threads.
   ===================================================================== */

/* Booking call-to-action button row */
.booking-cta { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: .5rem; }
.booking-cta .btn { flex: 1 1 200px; }

/* Friendly empty states */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--gray-500, #6b7280); }
.empty-state i { font-size: 2.1rem; color: var(--gray-300, #d1d5db); margin-bottom: .75rem; display: block; }
.empty-state p { margin: 0 auto; max-width: 400px; }

/* Avatars (reused for cleaner cards + lists) */
.cl-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; overflow: hidden; flex: 0 0 auto;
    background: var(--gradient-primary, linear-gradient(135deg, #0ea5e9, #10b981));
    color: #fff; font-weight: 800;
}
.cl-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Rating stars */
.rating-stars { color: #f59e0b; font-size: .8rem; letter-spacing: 1px; white-space: nowrap; }
.rating-num { font-weight: 700; color: var(--dark, #0f172a); font-size: .82rem; }
.muted { color: var(--gray-400, #9ca3af); }

/* Cleaner picker grid */
.cleaner-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.cleaner-card {
    border: 2px solid var(--gray-200, #e5e7eb); border-radius: 16px; padding: 1.1rem;
    cursor: pointer; transition: all .18s ease; background: #fff; position: relative;
}
.cleaner-card:hover { border-color: var(--primary-light, #7dd3fc); transform: translateY(-2px); box-shadow: 0 10px 24px -12px rgba(0,0,0,.25); }
.cleaner-card.selected { border-color: var(--primary, #0ea5e9); box-shadow: 0 0 0 3px rgba(14,165,233,.14); }
.cleaner-card-top { display: flex; align-items: center; gap: .75rem; }
.cleaner-card-id { flex: 1; min-width: 0; }
.cleaner-card-id strong { display: block; }
.cleaner-card-rating { margin-top: .15rem; }
.cleaner-check { color: var(--primary, #0ea5e9); font-size: 1.25rem; opacity: 0; transition: opacity .15s; }
.cleaner-card.selected .cleaner-check { opacity: 1; }
.cleaner-card-meta { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: .8rem; color: var(--gray-500, #6b7280); font-size: .8rem; }
.cleaner-card-meta i { color: var(--gray-400, #9ca3af); margin-right: .25rem; }
.cleaner-card-badges { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .7rem; }

/* Cleaner online/offline bar */
.online-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    background: #fff; border: 1px solid var(--gray-200, #e5e7eb); border-radius: 14px;
    padding: .85rem 1.25rem; margin-bottom: 1.5rem; box-shadow: var(--shadow, 0 1px 3px rgba(0,0,0,.08));
}
.online-status { font-weight: 700; display: inline-flex; align-items: center; gap: .5rem; }
.online-status i { font-size: .6rem; }
.online-status.on { color: #059669; }
.online-status.off { color: var(--gray-400, #9ca3af); }

/* Job offers */
.offer-card {
    display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
    border: 1px solid var(--gray-200, #e5e7eb); border-left: 4px solid var(--accent, #f59e0b);
    border-radius: 14px; padding: 1rem 1.25rem; background: var(--gray-50, #f9fafb);
}
.offer-main { flex: 1; min-width: 200px; }
.offer-meta { display: flex; flex-wrap: wrap; gap: .85rem; margin-top: .4rem; color: var(--gray-500, #6b7280); font-size: .82rem; }
.offer-meta i { color: var(--gray-400, #9ca3af); margin-right: .25rem; }
.offer-timer { margin-top: .5rem; font-size: .78rem; font-weight: 700; color: #b45309; }
.offer-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.offer-earn { font-weight: 800; font-size: 1.15rem; color: var(--dark, #0f172a); margin-right: .35rem; }

/* Live status tracker */
.track { display: flex; gap: .25rem; }
.track-step { flex: 1; text-align: center; position: relative; color: var(--gray-400, #9ca3af); }
.track-step::before { content: ""; position: absolute; top: 18px; left: -50%; width: 100%; height: 3px; background: var(--gray-200, #e5e7eb); z-index: 0; }
.track-step:first-child::before { display: none; }
.track-dot {
    position: relative; z-index: 1; width: 38px; height: 38px; border-radius: 50%;
    background: var(--gray-100, #f3f4f6); color: var(--gray-400, #9ca3af);
    display: inline-flex; align-items: center; justify-content: center;
    border: 2px solid var(--gray-200, #e5e7eb); transition: all .25s ease;
}
.track-label { font-size: .76rem; margin-top: .45rem; font-weight: 600; }
.track-step.done { color: var(--dark, #0f172a); }
.track-step.done .track-dot { background: var(--secondary, #10b981); border-color: var(--secondary, #10b981); color: #fff; }
.track-step.done::before { background: var(--secondary, #10b981); }
/* the first not-yet-reached step after a done step = "current", pulse it */
.track-step.done + .track-step:not(.done) .track-dot { border-color: var(--primary, #0ea5e9); color: var(--primary, #0ea5e9); animation: trackPulse 1.5s infinite; }
@keyframes trackPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(14,165,233,.35); } 50% { box-shadow: 0 0 0 7px rgba(14,165,233,0); } }

/* Message thread */
.msg-thread { max-height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: .55rem; padding: .25rem; }
.msg-row { display: flex; }
.msg-row.mine { justify-content: flex-end; }
.msg-bubble { display: inline-block; max-width: 80%; padding: .6rem .9rem; border-radius: 14px; background: var(--gray-100, #f3f4f6); color: var(--dark, #0f172a); line-height: 1.4; }
.msg-row.mine .msg-bubble { background: var(--primary, #0ea5e9); color: #fff; }
.msg-meta { display: block; margin-top: .25rem; font-size: .68rem; opacity: .72; }

/* Additional status badges */
.badge-soft.s-offered { background: #dbeafe; color: #1e40af; }
.badge-soft.s-declined, .badge-soft.s-expired { background: #f3f4f6; color: #6b7280; }

/* Subtle row hover on data tables */
.table tbody tr:hover { background: var(--gray-50, #f9fafb); }

@media (max-width: 560px) {
    .track-label { font-size: .64rem; }
    .cleaner-grid { grid-template-columns: 1fr 1fr; }
    .offer-actions { width: 100%; }
}

/* ============================================================
   Premium portal theme (Trust Refresh) — navy + gold + Fraunces
   Applies to cleaner / customer / admin portals uniformly.
   ============================================================ */
:root {
  --pnavy:#0f2540; --pnavy2:#15304d; --pgold:#f5b301; --psky:#0ea5e9;
  --pemerald:#10b981; --pmist:#f4f8fc; --pline:#e6eef7;
  --pfont-display:'Fraunces', Georgia, 'Times New Roman', serif;
}
.dashboard { background: var(--pmist); }
.sidebar {
  background: linear-gradient(185deg, #0f2540 0%, #112c4a 58%, #0b1d34 100%);
  padding: 1.75rem 1.2rem; border-right: 1px solid rgba(255,255,255,.06);
}
.sidebar-logo { font-family: var(--pfont-display); font-weight: 600; letter-spacing: -.01em; margin-bottom: 2rem; }
.sidebar-role { color: rgba(255,255,255,.55) !important; }
.sidebar-divider { border-color: rgba(255,255,255,.08) !important; }
.sidebar-menu a { color: rgba(255,255,255,.74); font-weight: 500; border-radius: 12px; padding: .8rem 1rem; }
.sidebar-menu a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-menu a.active { background: linear-gradient(135deg, var(--psky), var(--pemerald)); color: #fff; box-shadow: 0 10px 20px -10px rgba(14,165,233,.85); }
.sidebar-menu a.active i { color: #fff; }
.main-content { background: var(--pmist); }
.portal-topbar { background: #fff; border: 1px solid var(--pline); border-radius: 16px; box-shadow: 0 12px 30px -24px rgba(15,37,64,.4); }
.portal-topbar-title h1 { font-family: var(--pfont-display); font-weight: 600; color: var(--pnavy); letter-spacing: -.01em; }
.portal-bell-badge { background: var(--pgold); color: var(--pnavy); }
.portal-user-avatar { background: linear-gradient(135deg, var(--pnavy), var(--psky)); color: #fff; }
.section-card, .kpi-card, .plan-card, .cleaner-card, .offer-card, .area-result {
  border: 1px solid var(--pline); border-radius: 18px; box-shadow: 0 14px 32px -22px rgba(15,37,64,.32);
}
.section-card-header { border-bottom: 1px solid var(--pline); }
.section-card-header h2, .section-card-header h3 { font-family: var(--pfont-display); font-weight: 600; color: var(--pnavy); }
.kpi-card { transition: transform .25s ease, box-shadow .25s ease; }
.kpi-card:hover { transform: translateY(-4px); box-shadow: 0 22px 44px -24px rgba(15,37,64,.45); }
.kpi-value { font-family: var(--pfont-display); font-weight: 600; color: var(--pnavy); }
.dash-hero {
  background: linear-gradient(135deg, #0f2540 0%, #15304d 55%, #0284c7 130%) !important;
  color: #fff !important; border: none; border-radius: 20px;
}
.dash-hero h1, .dash-hero h2, .dash-hero p { color: #fff !important; }
.btn-primary { background: var(--psky); border-color: var(--psky); }
.btn-primary:hover { background: #0284c7; border-color: #0284c7; }
