/* =====================================================================
   CRM דור מור יוסף — Design System
   crm.dmy.co.il · RTL · Heebo
   ===================================================================== */

/* ---------------------------------------------------------------
   1. משתנים
   --------------------------------------------------------------- */
:root {
    /* צבעי מותג */
    --blue:           #1668E3;
    --blue-dark:      #1150B4;
    --blue-light:     #E8F1FE;
    --blue-soft:      #F2F7FF;

    /* Sidebar */
    --nav-bg:         #0D1836;
    --nav-bg-hover:   #16234A;
    --nav-bg-active:  #1B2C5C;
    --nav-text:       #C3CEE3;
    --nav-text-active:#FFFFFF;

    /* מצבים */
    --green:          #10B981;
    --green-light:    #DCFCE7;
    --green-text:     #047857;
    --orange:         #F59E0B;
    --orange-light:   #FEF3C7;
    --orange-text:    #B45309;
    --red:            #EF4444;
    --red-light:      #FEE2E2;
    --red-text:       #B91C1C;
    --purple:         #8B5CF6;
    --purple-light:   #EDE9FE;
    --purple-text:    #6D28D9;
    --yellow:         #EAB308;
    --yellow-light:   #FEF9C3;
    --yellow-text:    #A16207;
    --gray:           #94A3B8;
    --gray-light:     #F1F5F9;
    --gray-text:      #475569;

    /* ניטרליים */
    --bg:             #F5F8FD;
    --card:           #FFFFFF;
    --border:         #E6ECF5;
    --border-strong:  #D4DEEC;
    --text:           #16243F;
    --text-muted:     #6B7C99;
    --text-light:     #94A3B8;

    /* מידות */
    --nav-w:          212px;
    --topbar-h:       62px;
    --radius:         14px;
    --radius-sm:      9px;
    --radius-lg:      18px;

    --shadow-sm:      0 1px 2px rgba(16,36,73,.05);
    --shadow:         0 2px 8px rgba(16,36,73,.06);
    --shadow-md:      0 4px 16px rgba(16,36,73,.08);
    --shadow-lg:      0 12px 32px rgba(16,36,73,.12);

    --font:           'Heebo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

/* ---------------------------------------------------------------
   2. איפוס
   --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    direction: rtl;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 { margin: 0; font-weight: 700; line-height: 1.3; }
p  { margin: 0 0 10px; }
a  { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
button { font-family: inherit; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #C8D4E6; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #A9BAD4; }

/* ---------------------------------------------------------------
   3. Sidebar
   --------------------------------------------------------------- */
/* המערכת כולה RTL. ב-.sidebar ובמעטפת נעשה שימוש במאפיינים פיזיים
   במכוון: inset-inline-end ב-RTL מתורגם לשמאל, וזה בדיוק ההפך מהנדרש. */
.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    width: var(--nav-w);
    background: var(--nav-bg);
    display: flex;
    flex-direction: column;
    z-index: 200;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.sidebar-brand {
    padding: 18px 16px 16px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-brand .brand-name {
    color: #fff;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -.3px;
}
.sidebar-brand .brand-slogan {
    color: #7E90B4;
    font-size: 10.5px;
    margin-top: 2px;
}
.sidebar-brand img { margin: 0 auto 6px; max-height: 42px; width: auto; }

.nav { padding: 10px 9px; flex: 1; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    margin-bottom: 2px;
    border-radius: var(--radius-sm);
    color: var(--nav-text);
    font-size: 13.5px;
    font-weight: 500;
    transition: background .15s, color .15s;
    position: relative;
}
.nav-item:hover { background: var(--nav-bg-hover); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--nav-bg-active); color: var(--nav-text-active); font-weight: 600; }
.nav-item.active::before {
    content: '';
    position: absolute;
    right: 0;
    top: 9px;
    bottom: 9px;
    width: 3px;
    border-radius: 3px 0 0 3px;
    background: var(--blue);
}
.nav-icon {
    width: 19px;
    flex: 0 0 19px;
    text-align: center;
    font-size: 15px;
    opacity: .9;
}
.nav-text { flex: 1; }
.nav-badge {
    background: var(--red);
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sidebar-footer {
    padding: 12px 11px 16px;
    border-top: 1px solid rgba(255,255,255,.07);
}
.help-box {
    background: rgba(255,255,255,.05);
    border-radius: var(--radius-sm);
    padding: 10px;
    margin-bottom: 9px;
    display: flex;
    align-items: center;
    gap: 9px;
}
.help-box .help-icon { font-size: 18px; }
.help-box .help-label { color: #8DA0C2; font-size: 10.5px; }
.help-box .help-phone { color: #fff; font-weight: 700; font-size: 13px; direction: ltr; }

.btn-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    padding: 9px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 7px;
    border: 0;
    cursor: pointer;
}
.btn-nav:hover { text-decoration: none; opacity: .92; }
.btn-nav.whatsapp { background: #25D366; }
.btn-nav.call { background: var(--blue); }

/* ---------------------------------------------------------------
   4. אזור ראשי
   --------------------------------------------------------------- */
.main-area { margin-right: var(--nav-w); min-height: 100vh; }

.topbar {
    height: var(--topbar-h);
    background: var(--card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-search { flex: 1; max-width: 470px; margin: 0 auto; position: relative; }
.topbar-search input {
    width: 100%;
    height: 38px;
    padding: 0 38px 0 56px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #F7FAFE;
    font-family: var(--font);
    font-size: 13px;
    color: var(--text);
    outline: none;
    transition: border-color .15s, background .15s;
}
.topbar-search input:focus { border-color: var(--blue); background: #fff; }
.topbar-search input::placeholder { color: var(--text-light); }
.topbar-search .search-icon {
    position: absolute;
    inset-inline-start: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    pointer-events: none;
}
.topbar-search .search-kbd {
    position: absolute;
    inset-inline-end: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10.5px;
    color: var(--text-light);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 2px 6px;
    pointer-events: none;
}

.topbar-meta { color: var(--text-muted); font-size: 12.5px; white-space: nowrap; }

.icon-btn {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 17px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.icon-btn:hover { background: var(--gray-light); color: var(--text); }
.icon-btn .dot {
    position: absolute;
    top: 4px;
    inset-inline-end: 4px;
    background: var(--red);
    color: #fff;
    font-size: 9.5px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.topbar-user { display: flex; align-items: center; gap: 9px; }
.topbar-user .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 36px;
}
.topbar-user .u-name { font-weight: 600; font-size: 13px; line-height: 1.2; }
.topbar-user .u-role { color: var(--text-muted); font-size: 11px; }

.page-wrap { padding: 20px 24px 40px; max-width: 1600px; margin: 0 auto; }

/* ---------------------------------------------------------------
   5. כותרת עמוד
   --------------------------------------------------------------- */
.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.page-head .titles { display: flex; align-items: center; gap: 11px; }
.page-head h1 { font-size: 25px; color: var(--blue); letter-spacing: -.4px; }
.page-head .subtitle { color: var(--text-muted); font-size: 13px; margin-top: 1px; }
.page-head .page-icon { font-size: 26px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------
   6. כרטיסים
   --------------------------------------------------------------- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
    overflow: hidden;
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 15.5px; }
.card-head .card-link { font-size: 12.5px; font-weight: 600; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

/* ---------------------------------------------------------------
   7. כרטיסי KPI
   --------------------------------------------------------------- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 13px;
    margin-bottom: 18px;
}
.kpi-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
.kpi-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.kpi-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 1420px) {
    .kpi-grid, .kpi-grid.cols-5 { grid-template-columns: repeat(3, 1fr); }
    .kpi-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
    .kpi-grid, .kpi-grid.cols-5, .kpi-grid.cols-4, .kpi-grid.cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}
.kpi-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 13px;
}
.kpi-icon {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
}
.kpi-icon.blue   { background: var(--blue-light);   }
.kpi-icon.green  { background: var(--green-light);  }
.kpi-icon.orange { background: var(--orange-light); }
.kpi-icon.red    { background: var(--red-light);    }
.kpi-icon.purple { background: var(--purple-light); }
.kpi-icon.gray   { background: var(--gray-light);   }

.kpi-body { min-width: 0; }
.kpi-value { font-size: 21px; font-weight: 800; letter-spacing: -.5px; line-height: 1.2; }
.kpi-label { color: var(--text-muted); font-size: 12.5px; }
.kpi-trend { font-size: 11.5px; font-weight: 600; margin-top: 3px; }
.kpi-trend.up   { color: var(--green-text); }
.kpi-trend.down { color: var(--red-text);   }
.kpi-trend span { color: var(--text-light); font-weight: 400; }

/* ---------------------------------------------------------------
   8. רשת
   --------------------------------------------------------------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2-1 { grid-template-columns: 2fr 1fr; }
.grid-1-2 { grid-template-columns: 1fr 2fr; }

/* ---------------------------------------------------------------
   9. טבלאות
   --------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
table.data th {
    text-align: start;
    padding: 11px 14px;
    font-weight: 600;
    font-size: 12.5px;
    color: var(--text-muted);
    background: #FAFCFF;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
table.data td {
    padding: 12px 14px;
    border-bottom: 1px solid #F1F5FB;
    vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #FAFCFF; }
table.data .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .strong { font-weight: 600; }

.cell-main { font-weight: 600; color: var(--text); }
.cell-sub  { color: var(--text-muted); font-size: 11.5px; }

/* ---------------------------------------------------------------
   10. תגיות
   --------------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.6;
}
.badge-blue   { background: var(--blue-light);   color: var(--blue-dark);    }
.badge-green  { background: var(--green-light);  color: var(--green-text);   }
.badge-orange { background: var(--orange-light); color: var(--orange-text);  }
.badge-yellow { background: var(--yellow-light); color: var(--yellow-text);  }
.badge-red    { background: var(--red-light);    color: var(--red-text);     }
.badge-purple { background: var(--purple-light); color: var(--purple-text);  }
.badge-gray   { background: var(--gray-light);   color: var(--gray-text);    }

/* ---------------------------------------------------------------
   11. כפתורים
   --------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 38px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-family: var(--font);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary          { background: var(--blue);  color: #fff; }
.btn-primary:hover    { background: var(--blue-dark); color: #fff; }
.btn-success          { background: var(--green); color: #fff; }
.btn-success:hover    { background: #059669; color: #fff; }
.btn-danger           { background: var(--red);   color: #fff; }
.btn-danger:hover     { background: #DC2626; color: #fff; }
.btn-whatsapp         { background: #25D366; color: #fff; }
.btn-whatsapp:hover   { background: #1EBE5B; color: #fff; }

.btn-outline          { background: #fff; border-color: var(--border-strong); color: var(--text); }
.btn-outline:hover    { background: #F7FAFE; border-color: var(--blue); color: var(--blue); }

.btn-ghost            { background: transparent; color: var(--text-muted); }
.btn-ghost:hover      { background: var(--gray-light); color: var(--text); }

.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 44px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { width: 38px; padding: 0; }

/* ---------------------------------------------------------------
   12. טפסים
   --------------------------------------------------------------- */
.form-row { margin-bottom: 14px; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

label.field-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 5px;
}
label.field-label .req { color: var(--red); }

.input, .select, .textarea {
    width: 100%;
    min-height: 40px;
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: #fff;
    font-family: var(--font);
    font-size: 13.5px;
    color: var(--text);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(22,104,227,.11);
}
.input::placeholder, .textarea::placeholder { color: var(--text-light); }
.input:disabled, .select:disabled { background: var(--gray-light); color: var(--text-muted); }
.textarea { min-height: 92px; resize: vertical; line-height: 1.6; }

.select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7C99' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    padding-left: 34px;
}

.input.error, .select.error, .textarea.error { border-color: var(--red); }
.field-error { color: var(--red-text); font-size: 11.5px; margin-top: 4px; }
.field-hint  { color: var(--text-light); font-size: 11.5px; margin-top: 4px; }

.input-ltr { direction: ltr; text-align: right; }

/* מתג */
.switch { position: relative; display: inline-block; width: 42px; height: 23px; flex: 0 0 42px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute;
    inset: 0;
    background: #CBD5E1;
    border-radius: 23px;
    cursor: pointer;
    transition: background .2s;
}
.switch .slider::before {
    content: '';
    position: absolute;
    width: 17px;
    height: 17px;
    top: 3px;
    right: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + .slider { background: var(--blue); }
.switch input:checked + .slider::before { transform: translateX(-19px); }

.checkbox-row { display: flex; align-items: center; gap: 9px; }

/* ---------------------------------------------------------------
   13. פילטרים
   --------------------------------------------------------------- */
.filter-bar {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 16px;
}
.filter-bar .input,
.filter-bar .select { width: auto; min-width: 155px; height: 38px; min-height: 38px; }
.filter-bar .grow { flex: 1; min-width: 200px; }

/* ---------------------------------------------------------------
   14. מצב ריק
   --------------------------------------------------------------- */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 42px; margin-bottom: 10px; opacity: .55; }
.empty-state p { font-size: 14px; }

/* ---------------------------------------------------------------
   15. עימוד
   --------------------------------------------------------------- */
.pagination {
    display: flex;
    gap: 5px;
    align-items: center;
    justify-content: center;
    padding: 14px;
    flex-wrap: wrap;
}
.page-btn {
    min-width: 33px;
    height: 33px;
    padding: 0 9px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.page-btn:hover { border-color: var(--blue); color: var(--blue); text-decoration: none; }
.page-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.page-btn.disabled { opacity: .4; pointer-events: none; }
.page-dots { color: var(--text-light); padding: 0 3px; }

/* ---------------------------------------------------------------
   16. הודעות
   --------------------------------------------------------------- */
.toast-stack {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 9px;
    max-width: 380px;
}
.toast {
    background: #fff;
    border: 1px solid var(--border);
    border-inline-start: 4px solid var(--blue);
    border-radius: 11px;
    box-shadow: var(--shadow-lg);
    padding: 12px 15px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13.5px;
    animation: toastIn .22s ease-out;
}
.toast.success { border-inline-start-color: var(--green);  }
.toast.error   { border-inline-start-color: var(--red);    }
.toast.warning { border-inline-start-color: var(--orange); }
.toast .toast-close {
    margin-inline-start: auto;
    background: none;
    border: 0;
    color: var(--text-light);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.alert {
    padding: 12px 15px;
    border-radius: 11px;
    font-size: 13.5px;
    margin-bottom: 14px;
    border: 1px solid transparent;
}
.alert-info    { background: var(--blue-light);   color: var(--blue-dark);   border-color: #C7DDFB; }
.alert-success { background: var(--green-light);  color: var(--green-text);  border-color: #A7F3D0; }
.alert-warning { background: var(--orange-light); color: var(--orange-text); border-color: #FDE68A; }
.alert-error   { background: var(--red-light);    color: var(--red-text);    border-color: #FECACA; }

/* ---------------------------------------------------------------
   17. רשימות פעילות
   --------------------------------------------------------------- */
.list-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 18px;
    border-bottom: 1px solid #F1F5FB;
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: #FAFCFF; }
.list-row .row-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 9px;
    background: var(--blue-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}
.list-row .row-body { flex: 1; min-width: 0; }
.list-row .row-title { font-weight: 600; font-size: 13.5px; }
.list-row .row-sub { color: var(--text-muted); font-size: 11.5px; }
.list-row .row-time { color: var(--text-light); font-size: 11.5px; white-space: nowrap; }

/* ---------------------------------------------------------------
   18. גרף עמודות פשוט (ללא ספרייה)
   --------------------------------------------------------------- */
.bar-list { display: flex; flex-direction: column; gap: 11px; }
.bar-item .bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 12.5px;
    margin-bottom: 4px;
}
.bar-item .bar-label .bar-name { font-weight: 500; }
.bar-item .bar-label .bar-value { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.bar-track { height: 8px; background: var(--gray-light); border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; background: var(--blue); transition: width .4s ease; }
.bar-fill.green  { background: var(--green);  }
.bar-fill.orange { background: var(--orange); }
.bar-fill.red    { background: var(--red);    }
.bar-fill.purple { background: var(--purple); }

/* ---------------------------------------------------------------
   19. מסך התחברות
   --------------------------------------------------------------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background:
        radial-gradient(1100px 520px at 78% -8%, rgba(22,104,227,.16), transparent 60%),
        linear-gradient(160deg, #0D1836 0%, #16234A 100%);
}
.login-card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(5,15,40,.4);
    padding: 34px 30px 28px;
}
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand .brand-name {
    font-size: 25px;
    font-weight: 800;
    color: var(--blue);
    letter-spacing: -.5px;
}
.login-brand .brand-slogan { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }
.login-title { text-align: center; font-size: 16px; margin-bottom: 18px; }
.login-footer {
    text-align: center;
    color: var(--text-light);
    font-size: 11.5px;
    margin-top: 20px;
}

/* ---------------------------------------------------------------
   20. בדיקת סביבה
   --------------------------------------------------------------- */
.check-group { margin-bottom: 8px; }
.check-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 18px;
    border-bottom: 1px solid #F1F5FB;
}
.check-row:last-child { border-bottom: 0; }
.check-status { font-size: 16px; flex: 0 0 20px; text-align: center; }
.check-name { flex: 0 0 210px; font-weight: 600; font-size: 13px; }
.check-value { flex: 0 0 190px; font-size: 13px; color: var(--text); direction: ltr; text-align: right; }
.check-note { flex: 1; color: var(--text-muted); font-size: 12px; }
.check-row.fail { background: #FFF7F7; }

/* ---------------------------------------------------------------
   21. עזרי פריסה
   --------------------------------------------------------------- */
.flex        { display: flex; }
.items-center{ align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 6px; }  .gap-2 { gap: 10px; } .gap-3 { gap: 16px; }
.mt-0 { margin-top: 0; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12.5px; }
.text-lg { font-size: 16px; }
.text-center { text-align: center; }
.text-green  { color: var(--green-text);  }
.text-red    { color: var(--red-text);    }
.text-orange { color: var(--orange-text); }
.fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------
   22. רספונסיביות
   --------------------------------------------------------------- */
@media (max-width: 1200px) {
    .grid-2-1, .grid-1-2, .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 991px) {
    .sidebar {
        transform: translateX(100%);
        transition: transform .25s ease;
        box-shadow: -8px 0 30px rgba(5,15,40,.3);
    }
    .sidebar.open { transform: translateX(0); }
    .main-area { margin-right: 0; }
    .nav-toggle { display: inline-flex !important; }
    .grid-2 { grid-template-columns: 1fr; }
    .page-wrap { padding: 16px 14px 32px; }
    .topbar { padding: 0 14px; gap: 10px; }
    .topbar-meta { display: none; }
    .nav-overlay {
        position: fixed;
        inset: 0;
        background: rgba(9,18,42,.45);
        z-index: 190;
    }
}

@media (max-width: 640px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .kpi-card { padding: 12px; flex-direction: column; align-items: flex-start; gap: 9px; }
    .kpi-icon { width: 38px; height: 38px; flex: 0 0 38px; font-size: 18px; }
    .kpi-value { font-size: 18px; }
    .page-head h1 { font-size: 20px; }
    .topbar-search { max-width: none; }
    .topbar-user .u-info { display: none; }
    .card-body { padding: 14px; }
    .btn { height: 40px; }
    .filter-bar .input, .filter-bar .select { width: 100%; min-width: 0; }
}

.nav-toggle { display: none; }

/* ---------------------------------------------------------------
   23. הדפסה
   --------------------------------------------------------------- */
@media print {
    .sidebar, .topbar, .page-actions, .filter-bar, .pagination, .toast-stack { display: none !important; }
    .main-area { margin: 0; }
    .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
    body { background: #fff; }
}

/* ---------------------------------------------------------------
   24. רכיבי מודולים — רשימות, כרטיסים, טפסים
   --------------------------------------------------------------- */

/* פעולות בשורת טבלה */
.row-actions { display: flex; gap: 5px; justify-content: flex-start; }
.mini-btn {
    width: 29px;
    height: 29px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-muted);
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.mini-btn:hover { border-color: var(--blue); background: var(--blue-soft); text-decoration: none; }
.mini-btn.danger:hover { border-color: var(--red); background: var(--red-light); }
.mini-btn.call:hover { border-color: var(--blue); background: var(--blue-light); }
.mini-btn.wa:hover { border-color: #25D366; background: #E6F9EE; }

/* תא טלפון */
.cell-phone { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.cell-phone-actions { display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
table.data tr:hover .cell-phone-actions { opacity: 1; }
@media (hover: none) { .cell-phone-actions { opacity: 1; } }

.table-summary {
    padding: 11px 18px;
    color: var(--text-muted);
    font-size: 12.5px;
    border-top: 1px solid var(--border);
}

/* בחירה מרובה */
.multi-box {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 10px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: #fff;
    max-height: 168px;
    overflow-y: auto;
}
.multi-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12.5px;
    cursor: pointer;
    user-select: none;
}
.multi-item:hover { border-color: var(--blue); }
.multi-item input { accent-color: var(--blue); margin: 0; }
.multi-item:has(input:checked) {
    background: var(--blue-light);
    border-color: var(--blue);
    color: var(--blue-dark);
    font-weight: 600;
}

/* אזור העלאת קבצים */
.file-drop {
    position: relative;
    border: 2px dashed var(--border-strong);
    border-radius: 12px;
    background: #FAFCFF;
    padding: 22px 16px;
    text-align: center;
    transition: border-color .15s, background .15s;
}
.file-drop:hover { border-color: var(--blue); background: var(--blue-soft); }
.file-drop .file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}
.file-drop-text { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text-muted); font-size: 13px; }
.file-drop-icon { font-size: 22px; color: var(--blue); }
.file-drop-text small { color: var(--text-light); font-size: 11px; }
.file-drop.has-files { border-color: var(--green); background: var(--green-light); }

/* כרטיס ישות — עמוד פרטים */
.detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.detail-title { display: flex; align-items: center; gap: 12px; }
.detail-title .detail-avatar {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    border-radius: 14px;
    background: var(--blue-light);
    color: var(--blue-dark);
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.detail-title h1 { font-size: 23px; color: var(--text); }
.detail-title .detail-sub { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

/* שורות מידע בכרטיס */
.info-list { display: flex; flex-direction: column; }
.info-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    border-bottom: 1px solid #F1F5FB;
    font-size: 13.5px;
}
.info-row:last-child { border-bottom: 0; }
.info-row .info-label { flex: 0 0 150px; color: var(--text-muted); font-size: 12.5px; }
.info-row .info-value { flex: 1; font-weight: 500; }
.info-row .info-value.ltr { direction: ltr; text-align: right; }

/* ציר זמן */
.timeline { position: relative; padding: 4px 0; }
.timeline::before {
    content: '';
    position: absolute;
    top: 8px;
    bottom: 8px;
    right: 17px;
    width: 2px;
    background: var(--border);
}
.timeline-item { position: relative; padding: 0 44px 18px 0; }
.timeline-item:last-child { padding-bottom: 2px; }
.timeline-dot {
    position: absolute;
    right: 8px;
    top: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--blue-light);
    color: var(--blue-dark);
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--border);
}
.timeline-title { font-weight: 600; font-size: 13.5px; }
.timeline-meta { color: var(--text-light); font-size: 11.5px; }
.timeline-body { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }

/* לוח קנבן */
.kanban {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(248px, 1fr);
    gap: 13px;
    overflow-x: auto;
    padding-bottom: 8px;
    align-items: start;
}
.kanban-col {
    background: #EFF4FB;
    border-radius: var(--radius);
    padding: 10px;
    min-height: 120px;
}
.kanban-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 6px 10px;
    font-weight: 700;
    font-size: 13.5px;
}
.kanban-count {
    background: #fff;
    border-radius: 20px;
    padding: 1px 9px;
    font-size: 11.5px;
    color: var(--text-muted);
}
.kanban-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 11px;
    padding: 11px;
    margin-bottom: 8px;
    box-shadow: var(--shadow-sm);
}
.kanban-card:hover { border-color: var(--blue); }
.kanban-card .kc-title { font-weight: 600; font-size: 13.5px; }
.kanban-card .kc-sub { color: var(--text-muted); font-size: 11.5px; margin-top: 2px; }
.kanban-card .kc-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 9px;
    padding-top: 8px;
    border-top: 1px solid #F1F5FB;
}

/* גלריית תמונות */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
.gallery-item {
    position: relative;
    border-radius: 11px;
    overflow: hidden;
    border: 1px solid var(--border);
    aspect-ratio: 4 / 3;
    background: var(--gray-light);
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; }
.gallery-item .gi-actions {
    position: absolute;
    top: 6px;
    left: 6px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity .15s;
}
.gallery-item:hover .gi-actions { opacity: 1; }
.gallery-item .gi-main {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: var(--blue);
    color: #fff;
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
}

/* תיבת סיכום כספי */
.money-box {
    background: #FAFCFF;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
}
.money-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    font-size: 13.5px;
}
.money-row.total {
    border-top: 1px solid var(--border-strong);
    margin-top: 6px;
    padding-top: 10px;
    font-weight: 700;
    font-size: 15px;
}
.money-row .m-label { color: var(--text-muted); }
.money-row .m-value { font-variant-numeric: tabular-nums; font-weight: 600; }

/* טאבים */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
    overflow-x: auto;
}
.tab {
    padding: 10px 16px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }

/* פס התקדמות */
.progress { height: 7px; background: var(--gray-light); border-radius: 5px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--blue); border-radius: 5px; }

/* שורת כפתורי שמירה דביקה */
.form-footer {
    position: sticky;
    bottom: 0;
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(6px);
    border-top: 1px solid var(--border);
    padding: 12px 0;
    display: flex;
    gap: 9px;
    margin-top: 6px;
    z-index: 20;
}

@media (max-width: 640px) {
    .info-row { flex-direction: column; align-items: flex-start; gap: 2px; }
    .info-row .info-label { flex: none; }
    .detail-title h1 { font-size: 19px; }
    .form-footer .btn { flex: 1; }
}
