:root{
    --dark:#0f172a;
    --blue:#2563eb;
    --purple:#7c3aed;
    --green:#16a34a;
    --orange:#f97316;
    --line:#e5e7eb;
    --muted:#64748b;
}
body{background:linear-gradient(180deg,#f8fbff,#eef4ff)}
.search-shell{padding:18px 0 50px}
.search-head{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:16px}
.search-brand{display:flex;align-items:center;gap:13px;color:inherit;text-decoration:none}
.search-logo,.search-fallback{width:66px;height:66px;border-radius:21px;object-fit:cover;background:#fff;border:1px solid var(--line);box-shadow:0 10px 28px rgba(15,23,42,.08)}
.search-fallback{display:grid;place-items:center;color:#fff;font-weight:1000;background:linear-gradient(135deg,var(--dark),var(--blue),var(--purple))}
.search-title h1{margin:0;font-size:29px;letter-spacing:-.03em;color:#0f172a}
.search-title p{margin:5px 0 0;color:var(--muted);font-weight:850}
.top-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}

.search-hero{
    background:
        radial-gradient(circle at top left,rgba(37,99,235,.18),transparent 35%),
        radial-gradient(circle at bottom right,rgba(249,115,22,.18),transparent 35%),
        #fff;
    border:1px solid #dbeafe;
    border-radius:28px;
    padding:16px;
    box-shadow:0 16px 42px rgba(15,23,42,.07);
    margin-bottom:14px;
}
.search-hero strong{display:block;color:#0f172a;font-size:20px;margin-bottom:5px}
.search-hero span{display:block;color:var(--muted);font-weight:850;line-height:1.4}

.dual-search-grid{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:14px;
    align-items:start;
}
.search-panel{
    background:#fff;
    border:1px solid var(--line);
    border-radius:28px;
    overflow:hidden;
    box-shadow:0 14px 36px rgba(15,23,42,.07);
}
.search-panel-head{
    padding:16px;
    color:#fff;
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:10px;
}
.search-panel.customer .search-panel-head{
    background:
        radial-gradient(circle at top left,rgba(255,255,255,.24),transparent 36%),
        linear-gradient(135deg,#0f172a,#2563eb,#7c3aed);
}
.search-panel.rider .search-panel-head{
    background:
        radial-gradient(circle at top left,rgba(255,255,255,.24),transparent 36%),
        linear-gradient(135deg,#14532d,#16a34a,#f97316);
}
.search-panel-head h2{
    margin:0;
    font-size:21px;
    letter-spacing:-.02em;
}
.search-panel-head small{
    display:block;
    margin-top:4px;
    color:rgba(255,255,255,.84);
    font-weight:850;
}
.panel-icon{
    width:46px;
    height:46px;
    border-radius:17px;
    display:grid;
    place-items:center;
    background:rgba(255,255,255,.16);
    font-size:22px;
    box-shadow:inset 0 0 0 1px rgba(255,255,255,.16);
}
.search-panel-body{padding:14px}
.search-input-wrap{position:relative}
.search-input{
    width:100%;
    min-height:56px;
    border:1px solid #cbd5e1;
    border-radius:18px;
    padding:0 46px 0 15px;
    font:inherit;
    font-weight:900;
    background:#fff;
    box-shadow:0 8px 22px rgba(15,23,42,.04);
}
.search-input:focus{
    outline:none;
    border-color:#93c5fd;
    box-shadow:0 0 0 4px rgba(37,99,235,.12);
}
.search-clear{
    position:absolute;
    right:8px;
    top:50%;
    transform:translateY(-50%);
    width:36px;
    height:36px;
    border:0;
    border-radius:13px;
    background:#f1f5f9;
    color:#0f172a;
    font-weight:1000;
    cursor:pointer;
}
.search-help{
    margin:9px 2px 0;
    color:var(--muted);
    font-size:12px;
    font-weight:850;
    line-height:1.4;
}
.result-list{display:grid;gap:10px;margin-top:14px}
.result-card{
    border:1px solid var(--line);
    border-radius:18px;
    background:#fff;
    padding:13px;
    display:grid;
    grid-template-columns:1fr auto;
    gap:10px;
    align-items:start;
    box-shadow:0 8px 22px rgba(15,23,42,.05);
    transition:transform .12s ease, box-shadow .12s ease;
}
.result-card:hover{transform:translateY(-1px);box-shadow:0 12px 28px rgba(15,23,42,.09)}
.result-card strong{display:block;color:#0f172a;font-size:16px}
.result-card small{display:block;color:var(--muted);font-weight:850;margin-top:4px;line-height:1.35}
.result-pill{
    border-radius:999px;
    padding:6px 9px;
    font-size:12px;
    font-weight:1000;
    white-space:nowrap;
}
.customer .result-pill{background:#eff6ff;color:#1d4ed8}
.rider .result-pill{background:#ecfdf5;color:#166534}
.empty{
    border:1px dashed #cbd5e1;
    border-radius:18px;
    padding:18px;
    text-align:center;
    color:var(--muted);
    background:#f8fafc;
    font-weight:850;
    margin-top:14px;
}
.loading{
    border:1px solid #dbeafe;
    border-radius:18px;
    padding:14px;
    color:#1d4ed8;
    background:#eff6ff;
    font-weight:900;
    margin-top:14px;
}
.count-chip{
    border-radius:999px;
    background:rgba(255,255,255,.16);
    color:#fff;
    padding:6px 10px;
    font-size:12px;
    font-weight:1000;
}
@media(max-width:900px){
    .dual-search-grid{grid-template-columns:1fr}
    .search-title h1{font-size:25px}
}
@media(max-width:640px){
    .search-shell{padding:12px 0 36px}
    .search-head{display:grid;grid-template-columns:1fr}
    .search-brand{
        background:linear-gradient(135deg,#0f172a,#2563eb,#7c3aed);
        color:#fff;
        border-radius:22px;
        padding:12px;
        box-shadow:0 16px 34px rgba(37,99,235,.22);
    }
    .search-title h1{font-size:22px;color:#fff}
    .search-title p{font-size:12px;color:rgba(255,255,255,.82)}
    .search-logo,.search-fallback{width:56px;height:56px;border-radius:17px}
    .top-actions .ghost-btn{width:100%;justify-content:center}
    .search-panel{border-radius:23px}
    .search-panel-head{padding:13px}
    .search-panel-head h2{font-size:18px}
    .panel-icon{width:40px;height:40px;border-radius:15px;font-size:19px}
    .result-card{grid-template-columns:1fr}
    .result-pill{width:max-content}
}

.gps-manual-btn{
    border:0;
    border-radius:999px;
    padding:8px 10px;
    background:#fee2e2;
    color:#991b1b;
    font-weight:1000;
    cursor:pointer;
    width:max-content;
}
.gps-modal-backdrop{
    position:fixed;
    inset:0;
    z-index:500;
    display:none;
    align-items:center;
    justify-content:center;
    padding:16px;
    background:rgba(15,23,42,.62);
    backdrop-filter:blur(8px);
}
.gps-modal-backdrop.open{display:flex}
.gps-modal-card{
    width:100%;
    max-width:420px;
    border-radius:24px;
    background:#fff;
    box-shadow:0 30px 90px rgba(15,23,42,.34);
    overflow:hidden;
}
.gps-modal-head{
    display:flex;
    justify-content:space-between;
    gap:10px;
    padding:15px;
    color:#fff;
    background:linear-gradient(135deg,#991b1b,#dc2626,#f97316);
}
.gps-modal-head h3{margin:0;font-size:20px}
.gps-modal-head button{border:0;border-radius:13px;background:rgba(255,255,255,.18);color:#fff;font-weight:1000;padding:7px 10px;cursor:pointer}
.gps-modal-body{padding:15px;display:grid;gap:10px}
.gps-modal-body label{display:grid;gap:5px;font-size:12px;text-transform:uppercase;font-weight:1000;color:#64748b}
.gps-modal-body input{min-height:44px;border:1px solid #cbd5e1;border-radius:14px;padding:0 11px;font-weight:850}
.gps-save-btn{border:0;border-radius:15px;min-height:46px;color:#fff;background:linear-gradient(135deg,#16a34a,#22c55e);font-weight:1000;cursor:pointer}


/* ==== CUSTOMER_PROFILE_RESTAURANT_FLOW_V11 ==== */
/* vTopCustomersOpen240: Top Customers as an always-visible section instead
   of a button that opens a closed modal. */
.tc-section{
    background:#fff;
    border:1px solid var(--line);
    border-radius:28px;
    overflow:hidden;
    box-shadow:0 14px 36px rgba(15,23,42,.07);
    margin-bottom:16px;
}
.tc-section-head{
    padding:16px;
    color:#fff;
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:10px;
    background:radial-gradient(circle at top left,rgba(255,255,255,.24),transparent 36%),linear-gradient(135deg,#7c3aed,#2563eb,#0f172a);
}
.tc-section-head h2{margin:0;font-size:21px;letter-spacing:-.02em}
.tc-section-head small{display:block;margin-top:4px;color:rgba(255,255,255,.84);font-weight:850}
.tc-section-body{padding:14px}
.tc-table-wrap{overflow-x:auto}
.tc-table{width:100%;border-collapse:separate;border-spacing:0 8px}
.tc-table th{
    text-align:left;font-size:11px;text-transform:uppercase;letter-spacing:.35px;
    color:var(--muted);font-weight:1000;padding:0 12px 4px;white-space:nowrap;
}
.tc-table th.right,.tc-table td.right{text-align:right}
.tc-table tbody tr{
    background:#fff;border:1px solid #e5e7eb;cursor:pointer;
    transition:background .12s ease,border-color .12s ease;
}
.tc-table tbody tr:hover{background:#eff6ff;border-color:#bfdbfe}
.tc-table td{padding:12px;white-space:nowrap;border-top:1px solid #e5e7eb;border-bottom:1px solid #e5e7eb}
.tc-table td:first-child{border-left:1px solid #e5e7eb;border-radius:14px 0 0 14px}
.tc-table td:last-child{border-right:1px solid #e5e7eb;border-radius:0 14px 14px 0}
.tc-table .tc-name-cell strong{display:block;color:#0f172a;font-size:14.5px}
.tc-table .tc-name-cell small{display:block;color:#64748b;font-weight:800;margin-top:2px}
.tc-table .tc-rank-cell{font-weight:1000;color:#7c3aed}
.tc-table .tc-paid-cell{color:#166534;font-weight:1000}
.tc-table .tc-due-cell{color:#991b1b;font-weight:1000}
.tc-filter-group{display:flex;flex-wrap:wrap;gap:6px}
.tc-filter-btn{
    border:0;border-radius:999px;padding:8px 13px;font-size:12px;font-weight:1000;
    background:rgba(255,255,255,.16);color:#fff;cursor:pointer;white-space:nowrap;
    transition:background .12s ease,color .12s ease;
}
.tc-filter-btn:hover{background:rgba(255,255,255,.28)}
.tc-filter-btn.active{background:#fff;color:#2563eb}
@media(max-width:640px){
    .tc-section-head{flex-direction:column;align-items:flex-start}
    .tc-filter-group{width:100%}
}
@media(max-width:800px){
    .tc-table thead{display:none}
    /* vMobileCustomerCard: rank used to get its own full 1/3-width grid
       column, so the small badge sat centered in a wide column with the name
       starting way off to the right -- the "arrow points from #1 to the far-
       away name" gap. Rank now gets a small fixed-width column just big
       enough for the badge; name starts right next to it. The 3 stat cells
       (orders/paid/remaining) sit in the 3 equal flexible columns below,
       lining up under the name -- not under the narrow rank column, which is
       intentionally left blank on that row. */
    .tc-table tbody tr{
        display:grid;
        grid-template-columns:44px repeat(3,1fr);
        gap:10px 10px;
        padding:14px;
        margin-bottom:8px;
        border:1px solid #e5e7eb !important;
        border-radius:16px;
        background:#fff;
        box-shadow:0 4px 14px rgba(15,23,42,.05);
    }
    .tc-table td{border:0 !important;padding:0 !important;white-space:normal}
    .tc-table td:first-child,.tc-table td:last-child{border-radius:0}
    .tc-table td::before{content:attr(data-label);display:block;font-size:10px;text-transform:uppercase;letter-spacing:.3px;color:#94a3b8;font-weight:1000;margin-bottom:3px}

    .tc-table .tc-rank-cell{
        grid-column:1/2;grid-row:1;
        display:flex;align-items:center;justify-content:center;
        width:34px;height:34px;border-radius:10px;
        background:#f5f3ff;color:#7c3aed;font-size:13px;font-weight:1000;
    }
    .tc-table .tc-rank-cell::before{display:none}

    .tc-table .tc-name-cell{
        grid-column:2/5;grid-row:1;
        align-self:center;
    }
    .tc-table .tc-name-cell::before{display:none}

    .tc-table td[data-label="Orders"]{grid-column:2/3;grid-row:2}
    .tc-table .tc-paid-cell{grid-column:3/4;grid-row:2}
    .tc-table .tc-due-cell{grid-column:4/5;grid-row:2}
}

/* Per-order payment tag (Paid / Pending / Partially Paid) shown alongside
   the existing order-status pill in the order history list. */
.cp-pay-pill{border-radius:999px;padding:5px 10px;font-size:11px;font-weight:1000;white-space:nowrap;margin-left:6px}
.cp-pay-pill.received{background:#dcfce7;color:#166534}
.cp-pay-pill.pending{background:#fee2e2;color:#991b1b}
.cp-pay-pill.partial{background:#fef3c7;color:#92400e}
.cp-pay-pill.unrecorded{background:#f1f5f9;color:#64748b}
.cp-order-tags{display:flex;flex-wrap:wrap;align-items:center;gap:0}

/* Received / Add Debt boxes inside the customer profile card. */
.cp-ledger-grid{display:grid;grid-template-columns:1fr;gap:9px;margin-bottom:14px}
.cp-ledger-box{border:1px solid #e5e7eb;border-radius:16px;padding:11px;background:#f8fafc}
.cp-ledger-box.received{background:#f0fdf4;border-color:#bbf7d0}
.cp-ledger-box.debt{background:#fef2f2;border-color:#fecaca}
.cp-ledger-box label{display:block;font-size:11px;text-transform:uppercase;letter-spacing:.3px;font-weight:1000;color:#475569;margin-bottom:6px}
.cp-ledger-row{display:flex;gap:7px}
.cp-ledger-row input{flex:1;min-width:0;border:1px solid #cbd5e1;border-radius:12px;padding:0 10px;min-height:40px;font:inherit;font-weight:800;background:#fff}
.cp-ledger-row button{border:0;border-radius:12px;padding:0 13px;font-weight:1000;color:#fff;cursor:pointer;white-space:nowrap}
.cp-ledger-box.received button{background:linear-gradient(135deg,#16a34a,#22c55e)}
.cp-ledger-box.debt button{background:linear-gradient(135deg,#dc2626,#f97316)}
.cp-ledger-msg{font-size:11px;font-weight:850;margin-top:6px;min-height:14px}
.cp-ledger-msg.ok{color:#166534}
.cp-ledger-msg.err{color:#991b1b}
@media(max-width:640px){.cp-ledger-box .cp-ledger-row{flex-wrap:wrap}}

/* Reusable floating card shell, shared by the customer profile card and the
   Top Customers list. */
.cp-modal-backdrop{
    position:fixed;inset:0;z-index:600;display:none;align-items:center;justify-content:center;
    padding:16px;background:rgba(15,23,42,.62);backdrop-filter:blur(8px);
}
.cp-modal-backdrop.open{display:flex}
.cp-modal-card{
    width:100%;max-width:640px;max-height:92vh;overflow:hidden;background:#fff;
    border-radius:26px;box-shadow:0 30px 90px rgba(15,23,42,.34);display:flex;flex-direction:column;
}
.cp-modal-head{
    padding:16px 18px;color:#fff;background:linear-gradient(135deg,#0f172a,#2563eb,#7c3aed);
    display:flex;justify-content:space-between;align-items:flex-start;gap:12px;
}
.cp-modal-head h3{margin:0;font-size:20px}
.cp-modal-head p{margin:4px 0 0;font-size:12px;font-weight:850;color:rgba(255,255,255,.85)}
.cp-modal-head button{border:0;border-radius:13px;background:rgba(255,255,255,.18);color:#fff;font-weight:1000;padding:8px 12px;cursor:pointer;flex-shrink:0}
.cp-modal-body{padding:16px;overflow:auto;background:linear-gradient(180deg,#fff,#f8fbff)}

.cp-stat-grid{display:grid;grid-template-columns:1fr 1fr 1fr;gap:9px;margin-bottom:14px}
.cp-stat{border:1px solid #e5e7eb;border-radius:16px;padding:11px;background:#f8fafc;text-align:center}
.cp-stat small{display:block;text-transform:uppercase;letter-spacing:.35px;font-size:10px;font-weight:1000;color:#64748b}
.cp-stat strong{display:block;margin-top:6px;font-size:17px;color:#0f172a}
.cp-stat.due strong{color:#991b1b}
.cp-stat.paid strong{color:#166534}
.cp-stat.progress strong{color:#1d4ed8}

.cp-orders-title{font-size:13px;font-weight:1000;color:#0f172a;margin:4px 0 8px;text-transform:uppercase;letter-spacing:.3px}
.cp-order-list{display:grid;gap:8px}
.cp-order-row{
    display:grid;grid-template-columns:1fr auto;gap:8px;align-items:center;
    border:1px solid #e5e7eb;border-radius:14px;padding:10px 12px;background:#fff;
}
.cp-order-row strong{display:block;color:#0f172a;font-size:14px}
.cp-order-row small{display:block;color:#64748b;font-weight:800;margin-top:2px}
.cp-order-pill{border-radius:999px;padding:5px 10px;font-size:11px;font-weight:1000;white-space:nowrap;background:#eff6ff;color:#1d4ed8}
.cp-order-pill.cancelled{background:#fee2e2;color:#991b1b}
.cp-order-pill.delivered{background:#dcfce7;color:#166534}

.cp-pager{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-top:12px}
.cp-pager button{border:0;min-height:40px;border-radius:13px;padding:0 14px;font-weight:1000;cursor:pointer;background:#f1f5f9;color:#0f172a}
.cp-pager button:disabled{opacity:.45;cursor:not-allowed}
.cp-pager strong{font-size:12px;color:#64748b}

.tc-row{
    display:grid;grid-template-columns:32px 1fr auto;gap:10px;align-items:center;
    border:1px solid #e5e7eb;border-radius:16px;padding:11px 13px;background:#fff;margin-bottom:9px;cursor:pointer;
    transition:background .12s ease,border-color .12s ease;
}
.tc-row:hover{background:#eff6ff;border-color:#bfdbfe}
.tc-rank{font-weight:1000;color:#7c3aed;font-size:15px;text-align:center}
.tc-row strong{display:block;color:#0f172a;font-size:15px}
.tc-row small{display:block;color:#64748b;font-weight:800;margin-top:2px}
.tc-amount{font-weight:1000;color:#166534;font-size:14px;white-space:nowrap}

@media(max-width:640px){
    .cp-stat-grid{grid-template-columns:1fr 1fr}
    .cp-order-row{grid-template-columns:1fr}
    .tc-row{grid-template-columns:24px 1fr;row-gap:6px}
    .tc-amount{grid-column:2/3}
}
