/* ============================================
   QWIK ADMIN PANEL - Main Stylesheet
   קובץ CSS ראשי לפאנל הניהול
   ============================================ */

/* ===== CSS VARIABLES ===== */
:root {
    --orange: #F15A24;
    --orange-light: #FFF0EB;
    --g50:  #F9FAFB;
    --g100: #F3F4F6;
    --g200: #E5E7EB;
    --g400: #9CA3AF;
    --g500: #6B7280;
    --g600: #4B5563;
    --g800: #1F2937;
    --topbar-height: 56px;
    --sidebar-width: 110px;
    --radius-md: 10px;
    --green-dark: #16A34A;
    --red-dark: #991B1B;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    direction: rtl;
    font-family: 'Open Sans', sans-serif;
}

/* ===== LAYOUT ===== */
.app-layout {
    display: flex;
    flex-direction: row-reverse;
    height: 100vh;
    overflow: hidden;
}

/* ===== SIDEBAR ===== */
.new-sidebar {
    width: var(--sidebar-width);
    background: #fff;
    border-left: 1px solid var(--g200);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 0;
    gap: 4px;
    flex-shrink: 0;
    z-index: 50;
    overflow-y: auto;
    height: 100vh;
    position: fixed;
    right: 0;
    top: 0;
}

.new-sidebar-logo {
    margin-bottom: 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.new-sidebar-logo-text {
    font-size: 16px;
    font-weight: 900;
    color: #F15A24;
    letter-spacing: -0.5px;
}

.new-sidebar-item {
    width: 90px;
    height: 64px;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: var(--g400);
    font-size: 11px;
    font-weight: 600;
    transition: all .15s;
    cursor: pointer;
    text-decoration: none;
    border: none;
    background: transparent;
    font-family: inherit;
}

.new-sidebar-item svg { width: 26px; height: 26px; stroke-width: 1.8; }
.new-sidebar-item:hover  { background: var(--g50);  color: var(--g600); }
.new-sidebar-item.active { background: var(--orange-light); color: var(--orange); }
.new-sidebar-spacer { flex: 1; }
.new-sidebar-divider { width: 70px; height: 1px; background: var(--g200); margin: 4px 0; }

/* ===== MAIN WRAP ===== */
.new-main-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-right: var(--sidebar-width);
}

/* ===== TOPBAR ===== */
.new-topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid var(--g200);
    display: flex;
    align-items: center;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 40;
    gap: 12px;
    direction: ltr;
    flex-shrink: 0;
}

.new-topbar-appname {
    font-size: 20px;
    font-weight: 800;
    color: #F15A24;
    letter-spacing: -0.5px;
    flex-shrink: 0;
    cursor: pointer;
}

.new-topbar-search {
    flex: 1;
    max-width: 500px;
    margin: 0 auto;
    margin-left: 20px;
    position: relative;
}

.new-topbar-search input {
    width: 100%;
    padding: 8px 36px 8px 12px;
    border: 1px solid var(--g200);
    border-radius: 20px;
    font-size: 13px;
    background: var(--g50);
    transition: border .15s;
    text-align: right;
    font-family: inherit;
    box-sizing: border-box;
}

.new-topbar-search input:focus { border-color: var(--orange); outline: none; }

.new-topbar-search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--g400);
    pointer-events: none;
}

/* Search Dropdown */
.search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0; right: 0;
    background: #fff;
    border: 1px solid var(--g200);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 9999;
    overflow: hidden;
    display: none;
    direction: rtl;
}
.search-dropdown.show { display: block; }

.search-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; cursor: pointer;
    transition: background .1s; color: var(--g800);
}
.search-item:hover { background: var(--g50); }
.search-item-icon { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 13px; font-weight: 700; color: #fff; }
.search-item-icon.user     { background: #3B82F6; }
.search-item-icon.business { background: var(--orange); }
.search-item-name { font-size: 13px; font-weight: 600; }
.search-item-sub  { font-size: 11px; color: var(--g400); margin-top: 1px; }
.search-item-badge { margin-right: auto; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.search-item-badge.user     { background: #EFF6FF; color: #3B82F6; }
.search-item-badge.business { background: var(--orange-light); color: var(--orange); }
.search-no-results { padding: 16px; text-align: center; font-size: 13px; color: var(--g400); }
.search-divider { font-size: 10px; font-weight: 700; color: var(--g400); padding: 6px 14px 4px; background: var(--g50); border-top: 1px solid var(--g100); }

/* Topbar Right */
.new-topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: auto; }

.new-topbar-icon {
    width: 34px; height: 34px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; position: relative;
    transition: background .15s;
    border: none; background: transparent;
}
.new-topbar-icon:hover { background: var(--g100); }
.new-topbar-icon svg { width: 19px; height: 19px; color: var(--g500); }

.new-topbar-notif-dot {
    position: absolute; top: 5px; right: 5px;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--orange); border: 2px solid #fff;
}

.new-topbar-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--orange); color: #fff;
    font-size: 13px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0; border: none;
}

/* ===== PAGE CONTENT ===== */
.new-page-content {
    flex: 1; overflow-y: auto; overflow-x: hidden;
    padding: 20px; direction: rtl;
}

/* ===== SNACKBAR ===== */
#new-snackbar {
    visibility: hidden; min-width: 200px;
    background: #333; color: #fff;
    text-align: center; border-radius: 8px;
    padding: 10px 16px; position: fixed;
    z-index: 9999; bottom: 30px; left: 50%;
    transform: translateX(-50%); font-size: 13px;
}
#new-snackbar.show { visibility: visible; animation: fadein 0.3s, fadeout 0.3s 2.2s; }

/* ===== STATS GRID ===== */
.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 22px; }

.stat-card {
    background: #fff; border: 1.5px solid var(--g200);
    border-radius: 14px; padding: 26px 20px;
    display: flex; align-items: flex-start; gap: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    border-color: var(--g300);
    transform: translateY(-2px);
}

.stat-icon { width: 56px; height: 56px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 24px; }
.stat-label { font-size: 13px; color: var(--g400); margin-bottom: 6px; font-weight: 600; }
.stat-val   { font-size: 34px; font-weight: 900; line-height: 1.1; color: var(--g800); letter-spacing: -0.5px; }
.stat-change { font-size: 12px; margin-top: 6px; color: var(--green-dark); font-weight: 700; }

/* ===== ACTION BAR ===== */
.action-bar { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; }

.btn-primary {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--orange); color: #fff;
    border: none; border-radius: 8px;
    padding: 8px 16px; font-size: 13px; font-weight: 700;
    cursor: pointer; transition: opacity .15s; font-family: inherit;
}
.btn-primary:hover { opacity: .9; }

.btn-secondary {
    display: inline-flex; align-items: center; gap: 6px;
    background: #fff; color: var(--g600);
    border: 1px solid var(--g200); border-radius: 8px;
    padding: 8px 14px; font-size: 13px; font-weight: 600;
    cursor: pointer; transition: background .15s; font-family: inherit;
}
.btn-secondary:hover { background: var(--g50); }

/* ===== FILTERS BAR ===== */
.filters-bar { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }

.filter-select {
    padding: 8px 12px; border: 1px solid var(--g200);
    border-radius: 8px; font-size: 13px; background: #fff;
    color: var(--g600); height: 36px; font-family: inherit; cursor: pointer;
}

.search-wrap { position: relative; flex: 1; min-width: 200px; }
.search-wrap svg { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--g400); pointer-events: none; }
.search-wrap input { width: 100%; padding: 8px 32px 8px 12px; border: 1px solid var(--g200); border-radius: 8px; font-size: 13px; background: #fff; height: 36px; font-family: inherit; box-sizing: border-box; }
.search-wrap input:focus { border-color: var(--orange); outline: none; }

/* ===== TABLE ===== */
.table-card { background: #fff; border: 1px solid var(--g200); border-radius: 12px; overflow: hidden; margin-bottom: 20px; }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th { background: var(--g50); padding: 11px 14px; text-align: right; font-weight: 700; font-size: 11.5px; color: var(--g600); border-bottom: 1px solid var(--g200); white-space: nowrap; }
.data-table tbody tr { border-bottom: 1px solid var(--g100); transition: background .1s; cursor: pointer; }
.data-table tbody tr:hover { background: #FFF7F4; }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody td { padding: 10px 14px; vertical-align: middle; white-space: nowrap; }

.user-cell { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: #fff; flex-shrink: 0; background: var(--orange); }
.user-name { font-weight: 700; font-size: 13px; color: var(--g800); }
.user-id   { font-size: 10px; color: var(--g400); margin-top: 1px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; }
.badge-active   { background: #DCFCE7; color: #166534; }
.badge-inactive { background: var(--g100); color: var(--g600); }
.badge-blocked  { background: #FEE2E2; color: #991B1B; }

/* Row Actions */
.row-actions { display: flex; gap: 5px; align-items: center; }
.row-action { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--g200); display: flex; align-items: center; justify-content: center; transition: all .15s; cursor: pointer; background: #fff; }
.row-action svg { width: 13px; height: 13px; }
.ra-msg:hover    { background: #EFF6FF; border-color: #BFDBFE; }
.ra-msg svg      { color: #3B82F6; }
.ra-coupon:hover { background: var(--orange-light); border-color: #FED7AA; }
.ra-coupon svg   { color: var(--orange); }
.ra-block:hover  { background: #FEE2E2; border-color: #FECACA; }
.ra-block svg    { color: #EF4444; }
.ra-more:hover   { background: var(--g100); }
.ra-more svg     { color: var(--g500); }
.ra-unlink:hover { background: var(--g100); }
.ra-unlink svg   { color: var(--g500); }

.row-num { width: 26px; height: 26px; border-radius: 50%; background: var(--g100); color: var(--g600); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin: 0 auto; }

/* ===== PAGINATION ===== */
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--g100); gap: 12px; }
.page-info { font-size: 12px; color: var(--g400); }
.page-btns { display: flex; gap: 4px; }
.page-btn { min-width: 30px; height: 30px; padding: 0 6px; border: 1px solid var(--g200); border-radius: 6px; background: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--g600); transition: all .15s; font-family: inherit; }
.page-btn:hover { background: var(--g50); }
.page-btn.active-page { background: var(--orange); color: #fff; border-color: var(--orange); font-weight: 700; }

/* ===== BOTTOM CARDS ===== */
.bottom-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.bottom-card { background: #fff; border: 1px solid var(--g200); border-radius: 12px; padding: 16px; display: flex; align-items: center; gap: 14px; cursor: pointer; transition: all .15s; }
.bottom-card:hover { border-color: var(--orange); box-shadow: 0 2px 10px rgba(241,90,36,.1); }
.bc-icon { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.bc-title { font-size: 13px; font-weight: 700; color: var(--g800); }
.bc-sub   { font-size: 11px; color: var(--g400); margin-top: 2px; }

/* ===== MODALS =====
   ⚠️  display נשלט בלעדית ע"י שתי השורות בסוף הקובץ
   ⚠️  אל תוסיף display: flex כאן!
   ============================================ */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    /* display נשלט בסוף הקובץ */
    align-items: center; justify-content: center;
}

.modal {
    background: #fff; border-radius: 16px; padding: 24px;
    width: 100%; max-width: 440px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    direction: rtl;
}
.modal-md { max-width: 520px; }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-title { font-size: 16px; font-weight: 800; }
.modal-title-icon { display: flex; align-items: center; gap: 8px; }
.modal-close { width: 28px; height: 28px; border-radius: 50%; border: none; background: var(--g100); cursor: pointer; font-size: 14px; }
.modal-loading { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 30px; color: var(--g400); font-size: 13px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 700; color: var(--g600); margin-bottom: 6px; }
.form-input { width: 100%; padding: 10px 12px; border: 1px solid var(--g200); border-radius: 8px; font-size: 13px; font-family: inherit; box-sizing: border-box; }
.form-input:focus { border-color: var(--orange); outline: none; }
.form-textarea { resize: none; }
.char-count { font-size: 11px; color: var(--g400); margin-top: 4px; }
.sms-target-name { font-size: 13px; font-weight: 700; color: var(--orange); padding: 8px 0; }
.coupon-target-box { background: var(--orange-light); border-radius: 10px; padding: 10px 12px; font-size: 12px; margin-bottom: 14px; }
.add-user-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Edit status selector */
.edit-status-row { display: flex; gap: 10px; margin-top: 6px; }
.edit-status-option { display: inline-flex; align-items: center; padding: 7px 14px; border: 2px solid var(--g200); border-radius: 10px; cursor: pointer; transition: all .15s; background: #fff; }
.edit-status-option:hover { border-color: var(--g400); }
.edit-status-option.edit-status-selected { border-color: var(--orange); background: var(--orange-light); }

/* ===== TOAST ===== */
.toast {
    position: fixed; bottom: 24px; left: 50%;
    transform: translateX(-50%);
    background: #1F2937; color: #fff;
    padding: 11px 24px; border-radius: 10px;
    font-size: 13px; font-weight: 600;
    z-index: 9999; direction: rtl; white-space: nowrap;
    animation: toastIn .25s ease;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== HIDE OLD ELEMENTS ===== */
/* .HeaderBox הוסר — נדרש ע"י Business.aspx ו-DeliveryMan.aspx */
.MenuDiv   { display: none !important; }
.Wrapper   { display: none !important; }

/* ===== ANIMATIONS ===== */
@keyframes fadein  { from { opacity: 0; bottom: 20px; } to { opacity: 1; bottom: 30px; } }
@keyframes fadeout { from { opacity: 1; bottom: 30px; } to { opacity: 0; bottom: 20px; } }
@keyframes spin    { to { transform: rotate(360deg); } }

/* ===== TOPBAR POPUPS ===== */
.topbar-popup-wrap { position: relative; }
.topbar-popup {
    position: absolute;
    top: calc(100% + 8px); right: 0; left: auto;
    transform: none;
    width: 300px;
    background: #fff; border: 1px solid var(--g200);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,.15);
    z-index: 600; direction: rtl; overflow: hidden;
    display: none;
}
.topbar-popup.show { display: block; }
.topbar-popup-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 10px; border-bottom: 1px solid var(--g100); }
.topbar-popup-title { font-size: 14px; font-weight: 800; color: var(--g800); }
.topbar-popup-link { font-size: 12px; color: var(--orange); text-decoration: none; font-weight: 600; cursor: pointer; }
.topbar-popup-link:hover { text-decoration: underline; }
.topbar-popup-list { max-height: 320px; overflow-y: auto; }
.topbar-popup-item { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--g100); transition: background .1s; cursor: pointer; }
.topbar-popup-item:last-child { border-bottom: none; }
.topbar-popup-item:hover { background: var(--g50); }
.topbar-popup-item-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 16px; }
.topbar-popup-item-text { flex: 1; }
.topbar-popup-item-title { font-size: 13px; font-weight: 600; color: var(--g800); }
.topbar-popup-item-sub   { font-size: 11px; color: var(--g400); margin-top: 2px; }
.topbar-popup-empty { padding: 28px 16px; text-align: center; font-size: 13px; color: var(--g400); }
.topbar-popup-empty svg { display: block; margin: 0 auto 8px; opacity: .3; }
.topbar-popup-footer { padding: 10px 16px; border-top: 1px solid var(--g100); text-align: center; }
.topbar-popup-footer a { font-size: 12px; color: var(--orange); text-decoration: none; font-weight: 700; }
.topbar-popup-footer a:hover { text-decoration: underline; }

.notif-dot-badge {
    position: absolute; top: 4px; right: 4px;
    min-width: 16px; height: 16px; border-radius: 8px;
    background: var(--orange); border: 2px solid #fff;
    font-size: 9px; font-weight: 800; color: #fff;
    display: flex; align-items: center; justify-content: center; padding: 0 3px;
}

/* ===== STAT ICON COLORS ===== */
.stat-icon-green  { background: #F0FDF4; }
.stat-icon-blue   { background: #EFF6FF; }
.stat-icon-orange { background: #FFF0EB; }
.stat-icon-red    { background: #FEF2F2; }
.stat-change.up   { color: #16A34A; }
.stat-change.down { color: #DC2626; }

/* Bottom card icon colors */
.bc-icon-orange { background: #FFF7ED; }
.bc-icon-blue   { background: #EFF6FF; }
.bc-icon-green  { background: #F0FDF4; }
.bc-icon-red    { background: #FEF2F2; }

/* ===== TABLE HELPERS ===== */
.col-num    { width: 44px; text-align: center; }
.td-date    { font-size: 12px; color: var(--g600); }
.td-orders  { font-weight: 700; font-size: 13px; color: var(--g800); }
.td-money   { font-weight: 700; font-size: 13px; color: var(--orange); }
.td-balance { font-size: 12px; color: var(--g500); }
.td-address { font-size: 12px; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-relative{ font-size: 12px; color: var(--g600); }
.td-muted   { color: var(--g600); }
.td-bold    { font-weight: 700; }
.contact-phone { font-size: 12px; }
.contact-email { font-size: 11px; color: var(--g400); }
.dot-green  { background: #22C55E; }
.dot-red    { background: #EF4444; }
.dot-yellow { background: #F59E0B; }
.action-img-btn { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--g200); cursor: pointer; vertical-align: middle; }
.row-action-sm { width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--g200); display: flex; align-items: center; justify-content: center; cursor: pointer; background: #fff; transition: background .15s; }
.row-action-sm:hover { background: var(--g50); }

/* ===== PAGE HEADER ===== */
.page-header-row { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; }
.page-title-row  { display: flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 800; color: var(--g800); }
.page-subtitle   { font-size: 13px; color: var(--g400); margin-top: 3px; }

/* ===== DROPDOWN ===== */
.global-dropdown { position: fixed; background: #fff; border: 1px solid var(--g200); border-radius: 10px; box-shadow: 0 4px 20px rgba(0,0,0,.15); z-index: 400; min-width: 180px; overflow: hidden; direction: rtl; }
.dd-item          { padding: 10px 14px; font-size: 13px; cursor: pointer; display: flex; align-items: center; gap: 8px; color: var(--g800); transition: background .1s; }
.dd-item:hover    { background: var(--g50); }
.dd-item-red      { color: #991B1B; border-top: 1px solid var(--g100); }
.dd-item-red:hover { background: #FEF2F2; }

/* ===== SPINNER ===== */
.spinner { width: 20px; height: 20px; border: 2px solid var(--g200); border-top-color: var(--orange); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; flex-shrink: 0; }

/* ===== BUTTONS MISC ===== */
.btn-sm     { padding: 6px 12px !important; font-size: 12px !important; }
.btn-danger { color: #991B1B !important; border-color: #FECACA !important; }
.btn-danger:hover { background: #FEF2F2 !important; }
.page-size-select { font-size: 11px; padding: 5px 8px; height: auto; }
.settings-actions { display: flex; flex-direction: column; gap: 9px; max-width: 300px; }

.edit-manager-hint {
    background: var(--g50);
    border: 1px solid var(--g200);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 12px;
    color: var(--g600);
}
.edit-manager-hint a { color: #F15A24; font-weight: 700; text-decoration: none; }

/* ===== PROFILE OVERLAY + PANEL ===== */
.profile-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 500; }
.profile-panel {
    position: fixed; top: 0; left: 0;
    right: var(--sidebar-width);
    height: 100vh; background: #fff;
    z-index: 501; overflow-y: auto; direction: rtl;
    box-shadow: 4px 0 24px rgba(0,0,0,0.12);
    display: flex; flex-direction: column;
}
.profile-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 20px; border-bottom: 1px solid var(--g100);
    background: #fff; position: sticky; top: 0; z-index: 2;
    flex-shrink: 0; gap: 10px;
}
.profile-breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--g400); }
.breadcrumb-link    { color: var(--orange); cursor: pointer; font-weight: 600; }
.breadcrumb-current { color: var(--g800); font-weight: 700; }
.profile-header-nav { display: flex; align-items: center; gap: 6px; margin-right: auto; }
.profile-back-btn {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px; color: var(--g600);
    border: 1px solid var(--g200); border-radius: 8px;
    padding: 5px 10px; background: #fff; cursor: pointer; font-family: inherit;
}
.profile-back-btn:hover { background: var(--g50); }
.profile-nav-btn { width: 26px; height: 26px; border: 1px solid var(--g200); border-radius: 6px; background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.profile-close-btn { background: var(--g100); border: none; border-radius: 50%; width: 28px; height: 28px; cursor: pointer; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.profile-body { padding: 20px; flex: 1; }
.profile-loading { display: flex; align-items: center; justify-content: center; padding: 60px; color: var(--g400); font-size: 13px; gap: 10px; }
.profile-error { padding: 40px; text-align: center; color: var(--g400); font-size: 13px; }
.profile-error a { color: var(--orange); }

/* ===== PROFILE CONTENT ===== */
.pv-title { font-size: 22px; font-weight: 800; color: var(--g800); display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.pv-subtitle { font-size: 13px; color: var(--g400); margin-bottom: 16px; }

.pv-stats-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 18px; }
.pv-stat { background: #fff; border: 1px solid var(--g200); border-radius: 12px; padding: 14px 12px; text-align: center; }
.pv-stat-label { font-size: 11px; color: var(--g400); margin-bottom: 6px; }
.pv-stat-icon  { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; margin: 0 auto 6px; }
.pv-stat-val   { font-size: 20px; font-weight: 800; color: var(--g800); line-height: 1.2; }
.pv-stat-val-sm{ font-size: 13px; line-height: 1.4; font-weight: 600; color: var(--g800); }
.pv-stat-sub   { font-size: 11px; color: var(--g400); margin-top: 2px; }
.pv-stat-badge { margin-top: 4px; }
.pv-stat-date  { font-size: 12px; font-weight: 600; color: var(--g600); margin-top: 4px; }
.pv-yellow { color: #F59E0B; }
.pv-orange { color: var(--orange); }
.pv-green  { color: #16A34A; }
.pv-gray   { color: var(--g500); }

/* Profile 2-col layout — RTL: first=right, second=left */
.pv-layout { display: grid; grid-template-columns: 280px 1fr; gap: 18px; align-items: start; direction: rtl; }
.pv-side { display: flex; flex-direction: column; gap: 12px; }
.pv-main { min-width: 0; }

/* Tabs */
.pv-tabs { display: flex; border-bottom: 2px solid var(--g100); margin-bottom: 14px; overflow-x: auto; gap: 0; }
.pv-tab { padding: 9px 13px; font-size: 12px; font-weight: 600; color: var(--g500); background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; font-family: inherit; white-space: nowrap; margin-bottom: -2px; transition: all .15s; display: flex; align-items: center; gap: 5px; }
.pv-tab:hover { color: var(--orange); }
.pv-tab.active { color: var(--orange); border-bottom-color: var(--orange); }
.pv-tab svg { width: 12px; height: 12px; }
.pv-tab-content { direction: rtl; }
.pv-tab-hidden  { display: none !important; }

/* Sections */
.pv-section { background: #fff; border: 1px solid var(--g200); border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
.pv-section-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--g100); }
.pv-section-title  { font-size: 13px; font-weight: 700; color: var(--g800); display: flex; align-items: center; gap: 8px; }
.pv-section-count  { background: var(--g100); border-radius: 10px; padding: 1px 7px; font-size: 11px; color: var(--g500); font-weight: 600; }
.pv-section-actions{ display: flex; gap: 6px; }
.pv-section-body   { padding: 14px 16px; }
.pv-section-empty  { color: var(--g400); font-size: 13px; text-align: center; padding: 14px 16px; }
.pv-section-footer { padding: 10px 16px; border-top: 1px solid var(--g100); text-align: center; }
.empty-state { padding: 40px; text-align: center; color: var(--g400); font-size: 13px; }

/* Stats mini */
.stats-mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sm-item  { background: var(--g50); border-radius: 8px; padding: 10px 12px; border: 1px solid var(--g100); }
.sm-label { font-size: 10px; color: var(--g400); margin-bottom: 3px; }
.sm-val   { font-size: 15px; font-weight: 800; color: var(--g800); }
.sm-val-sm{ font-size: 11px; }
.side-empty { font-size: 12px; color: var(--g400); padding: 4px 0; }

/* Mini table */
.mini-table { width: 100%; border-collapse: collapse; font-size: 12px; direction: rtl; }
.mini-table thead th { background: var(--g50); padding: 8px 10px; text-align: right; font-weight: 700; font-size: 11px; color: var(--g600); border-bottom: 1px solid var(--g200); white-space: nowrap; }
.mini-table tbody tr { border-bottom: 1px solid var(--g100); transition: background .1s; cursor: pointer; }
.mini-table tbody tr:hover { background: #FFF7F4; }
.mini-table tbody tr:last-child { border-bottom: none; }
.mini-table tbody td { padding: 8px 10px; vertical-align: middle; white-space: nowrap; }
.order-num-cell { font-weight: 700; color: var(--orange); font-size: 13px; }

/* Side cards */
.side-card { background: #fff; border: 1px solid var(--g200); border-radius: 12px; padding: 16px; }
.side-card-title { font-size: 12px; font-weight: 800; color: var(--g800); margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }
.side-count-pill { background: var(--g100); border-radius: 10px; padding: 1px 7px; font-size: 10px; font-weight: 600; color: var(--g500); }
.side-add-btn { background: var(--orange); color: #fff; border: none; border-radius: 6px; padding: 3px 9px; font-size: 11px; font-weight: 700; cursor: pointer; }

/* User card in sidebar */
.side-user-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--g100); }
.side-avatar { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 800; color: #fff; flex-shrink: 0; }
.side-user-name { font-size: 16px; font-weight: 800; color: var(--g800); }
.side-user-tag { display: inline-flex; align-items: center; gap: 4px; background: #DCFCE7; color: #166534; border-radius: 12px; padding: 2px 8px; font-size: 11px; font-weight: 700; margin-top: 3px; }
.side-user-tag.blocked { background: #FEE2E2; color: #991B1B; }
.side-contact-row { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--g600); padding: 6px 0; border-bottom: 1px solid var(--g100); }
.side-contact-row:last-of-type { border-bottom: none; }
.side-note { font-size: 11px; color: var(--g400); padding: 6px 0; border-top: 1px solid var(--g100); margin-top: 2px; }

/* Quick actions */
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.qa-btn { padding: 10px 8px; border-radius: 8px; border: none; font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit; display: flex; align-items: center; justify-content: center; gap: 5px; transition: opacity .15s; }
.qa-btn:hover { opacity: .85; }
.qa-btn svg { width: 13px; height: 13px; }
.qa-blue   { background: #EFF6FF; color: #1D4ED8; }
.qa-orange { background: var(--orange-light); color: var(--orange); }
.qa-gray   { background: var(--g100); color: var(--g600); }
.qa-red    { background: #FEE2E2; color: #991B1B; }

/* Detail rows */
.detail-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--g100); font-size: 12px; }
.detail-row:last-child { border-bottom: none; }
.detail-key   { color: var(--g500); }
.detail-val   { color: var(--g800); font-weight: 600; max-width: 160px; text-align: left; }
.detail-green { color: #16A34A; font-weight: 600; }

/* Address items */
.addr-item { display: flex; align-items: flex-start; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--g100); }
.addr-item:last-child { border-bottom: none; }
.addr-icon { width: 26px; height: 26px; background: var(--orange-light); border-radius: 6px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; }
.addr-label { font-size: 12px; font-weight: 700; color: var(--g800); }
.addr-val   { font-size: 11px; color: var(--g500); margin-top: 1px; }
.addr-more  { font-size: 12px; color: var(--orange); cursor: pointer; font-weight: 600; text-align: center; padding: 6px 0; display: block; }

/* Coupon pill */
.coupon-pill { background: var(--g50); border-radius: 8px; padding: 10px 12px; border: 1px solid var(--g200); margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
.coupon-code { font-weight: 800; font-size: 13px; font-family: monospace; }
.coupon-s-active { background: #DCFCE7; color: #166534; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; }
.coupon-s-used   { background: var(--g100); color: var(--g500); padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; }

/* ===== RESPONSIVE ===== */
@media(max-width:1200px) { .stats-grid { grid-template-columns: repeat(3,1fr); } }
@media(max-width:1050px) { .pv-stats-strip { grid-template-columns: repeat(3,1fr); } .pv-layout { grid-template-columns: 1fr; } }
@media(max-width:900px)  { .stats-grid { grid-template-columns: repeat(2,1fr); } .bottom-cards { grid-template-columns: repeat(2,1fr); } }
@media(max-width:768px)  { .pv-stats-strip { grid-template-columns: repeat(2,1fr); } .profile-panel { right: 0; } }

/* ============================================================
   תיקון: עמודים ישנים (Business, DeliveryMan, Orders, Home)
   בתוך ה-layout החדש — HeaderBox עובר מ-fixed לstatic
   ============================================================ */

/* HeaderBox בתוך new-page-content: לא fixed, מוצג כ-header עמוד */
.new-page-content .HeaderBox {
    position: static !important;
    width: 100% !important;
    height: auto !important;
    z-index: auto !important;
    background-color: #fff !important;
    padding: 10px 16px !important;
    border-bottom: 3px solid #F15A24 !important;
    margin-bottom: 0 !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
}

/* HeaderBoxBg — מיותר ב-layout החדש */
.new-page-content .HeaderBoxBg {
    position: static !important;
    width: 100% !important;
    height: 4px !important;
    background-image: url('/images/new/Topbar_Line.png') !important;
    margin-bottom: 8px !important;
}

/* MainContentDiv — כבר בתוך new-page-content, לא צריך margin-top */
.new-page-content .MainContentDiv {
    margin-top: 0 !important;
    height: auto !important;
    overflow: visible !important;
}

/* ============================================================
   תיקון קונפליקט עם Bootstrap:
   Bootstrap מגדיר .modal { display: none } וזה מסתיר את
   תוכן המודל שלנו. מבטלים אותו בתוך ה-overlay שלנו.
   ============================================================ */
.modal-overlay .modal {
    display: block !important;
    position: relative !important;
    margin: auto !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
}

/* ============================================================
   MODAL DISPLAY CONTROL — שתי שורות אלה שולטות בכל המודלים
   חובה שיהיו בסוף הקובץ ולא יופיעו עוד פעם למעלה!
   ============================================================ */
.modal-overlay           { display: none !important; }
.modal-overlay.modal-open{ display: flex !important; }

/* Legacy Credits list adaptation, scoped to avoid other legacy pages. */
.crm-credits-table-scroll:focus-visible {
    outline: 2px solid var(--orange, #F15A24);
    outline-offset: -2px;
}

@media screen and (max-width: 1199px) {
    .crm-credits-page, .crm-credits-page .MainContentDiv, .crm-credits-page #ListDiv {
        min-width: 0; max-width: 100%;
    }
    .crm-credits-page .HeaderBox {
        justify-content: flex-start !important; box-sizing: border-box;
    }
    .crm-credits-page .HeaderBox > img { max-width: 100%; height: auto; }
    .crm-credits-page .HeaderSearchBox {
        flex: 1 1 240px; min-width: 0; max-width: 100%; box-sizing: border-box;
    }
    .crm-credits-page .inputTextSearch {
        min-width: 0; max-width: 100%; min-height: 44px; box-sizing: border-box; font-size: 16px;
    }
    .crm-credits-page .btnAddNew, .crm-credits-page .PageingDiv a,
    .crm-credits-page .popUpIn input[type="image"] {
        min-width: 44px; min-height: 44px; box-sizing: border-box;
        display: inline-flex; align-items: center; justify-content: center;
    }
    .crm-credits-page .btnAddNew { margin: 0 !important; }
    .crm-credits-table-scroll {
        max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain;
    }
    .crm-credits-table-scroll .ListDivParamsHead,
    .crm-credits-table-scroll .ListDivParams1,
    .crm-credits-table-scroll .ListDivParams2 { min-width: 760px; }
    .crm-credits-page .PageingDiv {
        display: flex; flex-wrap: wrap; justify-content: center; width: 100%; height: auto;
        gap: 4px; padding: 16px 0; box-sizing: border-box;
    }
    .crm-credits-page .PageingDiv a { float: none; padding: 8px 12px; }
    .crm-credits-page .popUpPush { padding: 12px; box-sizing: border-box; overflow: hidden; }
    .crm-credits-page .popUpIn {
        width: min(500px, 100%) !important; height: auto !important;
        position: relative; margin: auto !important;
        max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px);
        overflow-y: auto; box-sizing: border-box;
    }
    .crm-credits-page .popUpIn input[type="text"],
    .crm-credits-page .popUpIn input:not([type]) {
        min-height: 44px; max-width: 100%; box-sizing: border-box; font-size: 16px;
    }
}
