/* ═══════════════════════════════════════════
   בנין עולם – Design System 2025
═══════════════════════════════════════════ */
:root {
    --primary:        #7c3aed;
    --primary-dark:   #6d28d9;
    --primary-light:  #ede9fe;
    --primary-glow:   rgba(124,58,237,.13);
    --accent:         #f59e0b;

    --nav-bg:         #0f172a;
    --nav-active-bg:  rgba(124,58,237,.2);
    --nav-active-clr: #a78bfa;

    --bg:             #eef2ff;
    --surface:        #ffffff;
    --surface-2:      #f8fafc;
    --border:         #e2e8f0;
    --border-dark:    #cbd5e1;

    --text:           #0f172a;
    --text-muted:     #64748b;
    --text-light:     #94a3b8;

    --success:        #059669;
    --danger:         #dc2626;
    --warning:        #d97706;

    --shadow-sm:  0 1px 3px rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.03);
    --shadow-md:  0 4px 20px rgba(0,0,0,.09), 0 1px 4px rgba(0,0,0,.04);
    --shadow-lg:  0 24px 56px rgba(0,0,0,.18), 0 8px 20px rgba(0,0,0,.08);

    --radius:     13px;
    --radius-sm:  8px;
}

/* ═══════════════════════════════════════════
   Base & Font
═══════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    font-family: 'Heebo', 'Segoe UI', Arial, sans-serif;
    font-size: 15px;
    color: var(--text);
    background: var(--bg);
    direction: rtl;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* ═══════════════════════════════════════════
   Navigation Bar
═══════════════════════════════════════════ */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--nav-bg);
    padding: 0 28px;
    height: 62px;
    box-shadow: 0 4px 24px rgba(0,0,0,.35);
    /* signature colored top stripe */
    border-top: 2.5px solid transparent;
    border-image: linear-gradient(90deg, #7c3aed 0%, #a78bfa 50%, #818cf8 100%) 1;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: white;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -.4px;
    white-space: nowrap;
}

.brand-icon {
    font-size: 17px;
    background: linear-gradient(135deg, rgba(124,58,237,.4), rgba(167,139,250,.22));
    border: 1px solid rgba(167,139,250,.35);
    padding: 5px 8px;
    border-radius: 8px;
}

.brand-text { color: white; }
.brand-link:hover { opacity: .85; color: white; }
.nav-brand { margin-left: 28px; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 16px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,.82);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background .15s, color .15s;
    white-space: nowrap;
}

.nav-icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    opacity: .75;
    transition: opacity .15s;
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon { opacity: 1; }

.nav-item:hover { background: rgba(255,255,255,.08); color: white; }

.nav-item.active {
    background: var(--nav-active-bg);
    color: var(--nav-active-clr);
    font-weight: 600;
}

.nav-end { margin-right: auto; }

.nav-add-btn {
    display: flex;
    align-items: center;
    padding: 6px 16px;
    border-radius: var(--radius-sm);
    background: rgba(124,58,237,.22);
    color: #c4b5fd;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid rgba(167,139,250,.28);
    transition: background .15s, color .15s;
    white-space: nowrap;
}

.nav-add-btn:hover { background: rgba(124,58,237,.38); color: #ddd6fe; }

/* ═══════════════════════════════════════════
   Page Body
═══════════════════════════════════════════ */
.site-body {
    padding: 0 28px 24px;
    min-height: calc(100vh - 62px);
}

/* Cashbook pages (Mizrahi, Pagi) full-height flex layout */
body.cashbook-page .site-body {
    height: calc(100vh - 62px);
    min-height: unset;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0 28px;
}

body.cashbook-page .site-body > main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* ═══════════════════════════════════════════
   Cards
═══════════════════════════════════════════ */
.card-panel {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 20px 24px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

/* ═══════════════════════════════════════════
   Buttons
═══════════════════════════════════════════ */
.btn-primary {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    font-family: 'Heebo', sans-serif;
    font-weight: 600;
    border-radius: var(--radius-sm) !important;
    padding: 8px 20px !important;
    transition: background .15s, box-shadow .15s, transform .1s !important;
    box-shadow: 0 2px 8px rgba(124,58,237,.32);
}

.btn-primary:hover {
    background: var(--primary-dark) !important;
    box-shadow: 0 4px 14px rgba(124,58,237,.44) !important;
    transform: translateY(-1px);
}

.btn-danger {
    border-radius: var(--radius-sm) !important;
    font-family: 'Heebo', sans-serif;
}

/* ═══════════════════════════════════════════
   Form Controls
═══════════════════════════════════════════ */
.form-control, input[type="text"], input[type="email"], input[type="password"] {
    font-family: 'Heebo', sans-serif !important;
    border-radius: var(--radius-sm) !important;
    border: 1.5px solid var(--border-dark) !important;
    padding: 9px 13px !important;
    transition: border-color .15s, box-shadow .15s !important;
    background: var(--surface-2) !important;
}

.form-control:focus {
    border-color: var(--primary) !important;
    background: var(--surface) !important;
    box-shadow: 0 0 0 3px var(--primary-glow) !important;
}

label {
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
    margin-bottom: 5px;
}

/* ═══════════════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════════════ */
body.login-page {
    background:
        radial-gradient(ellipse at 15% 50%, rgba(124,58,237,.22) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 15%, rgba(99,102,241,.16) 0%, transparent 55%),
        radial-gradient(ellipse at 55% 85%, rgba(167,139,250,.14) 0%, transparent 50%),
        #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 0;
}

body.login-page .site-nav { display: none; }

body.login-page .site-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    min-height: 100vh;
    width: 100%;
    background: transparent;
}

.login-card {
    background: rgba(255,255,255,.97);
    border-radius: 20px;
    box-shadow: 0 32px 80px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.07);
    padding: 48px 52px;
    width: 100%;
    max-width: 420px;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo .logo-icon {
    font-size: 44px;
    display: block;
    margin-bottom: 10px;
    filter: drop-shadow(0 4px 14px rgba(124,58,237,.4));
}

.login-logo .logo-name {
    font-size: 23px;
    font-weight: 800;
    letter-spacing: -.5px;
    background: linear-gradient(135deg, #1e1b4b, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 28px;
    text-align: center;
}

.login-field { margin-bottom: 20px; }

.login-submit {
    width: 100%;
    padding: 12px !important;
    font-size: 15px !important;
    margin-top: 8px;
    border-radius: 10px !important;
    background: linear-gradient(135deg, #7c3aed, #6d28d9) !important;
    border-color: transparent !important;
    box-shadow: 0 4px 16px rgba(124,58,237,.42) !important;
    transition: box-shadow .15s, transform .12s !important;
}

.login-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(124,58,237,.52) !important;
}

/* ═══════════════════════════════════════════
   MIZRAHI PAGE
═══════════════════════════════════════════ */
.mizrahi-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    background: var(--bg);
    padding: 10px 0 8px;
    z-index: 20;
}

.page-title {
    margin: 0;
    font-weight: 800;
    font-size: 22px;
    letter-spacing: -.6px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #1e1b4b 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.top-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--surface);
    border: 1.5px solid var(--border-dark);
    border-radius: 20px;
    color: var(--text-muted);
    font-size: 12.5px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}

.top-action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.reset-balance-box {
    display: flex;
    flex-direction: row;
    align-items: center;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border: 1.5px solid #c4b5fd;
    border-radius: var(--radius);
    padding: 8px 16px;
    box-shadow: var(--shadow-sm);
    gap: 14px;
    direction: rtl;
}

.balance-top-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

/* vertical divider between label/date and value */
.balance-divider {
    width: 1.5px;
    align-self: stretch;
    background: #c4b5fd;
    border-radius: 2px;
    opacity: .6;
}

.reset-balance-label {
    font-family: 'Outfit', 'Heebo', sans-serif;
    font-size: 11px;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .8px;
    white-space: nowrap;
    opacity: .7;
}

.balance-date-input {
    direction: ltr;
    border: none;
    border-bottom: 2px solid rgba(124,58,237,.28);
    background: transparent;
    color: var(--primary);
    font-family: 'Outfit', 'Heebo', sans-serif;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -.4px;
    padding: 0 1px 1px;
    border-radius: 0;
    outline: none;
    cursor: pointer;
    transition: border-color .15s;
    min-width: 0;
}

.balance-date-input:hover { border-bottom-color: var(--primary); }
.balance-date-input:focus { border-bottom-color: var(--primary); box-shadow: none; }

.balance-amount-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.balance-amount-label {
    font-family: 'Outfit', 'Heebo', sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .8px;
    white-space: nowrap;
    opacity: .7;
}

.balance-amount-label.positive { color: var(--success); }
.balance-amount-label.negative { color: var(--danger); }

.reset-balance-value {
    font-family: 'Outfit', 'Heebo', sans-serif;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -.5px;
    direction: ltr;
    white-space: nowrap;
    border-bottom: 2px solid rgba(0,0,0,.12);
    padding-bottom: 1px;
}

.reset-balance-value.positive { border-bottom-color: rgba(5,150,105,.32); }
.reset-balance-value.negative { border-bottom-color: rgba(220,38,38,.32); }

.reset-balance-value.positive { color: var(--success); }
.reset-balance-value.negative { color: var(--danger); }

/* No-site clickable box */
.no-site-btn {
    border: none;
    cursor: pointer;
    transition: box-shadow .15s, transform .1s;
}
.no-site-btn:hover { box-shadow: 0 4px 14px rgba(194,65,12,.2); transform: translateY(-1px); }
.no-site-btn.active { outline: 2.5px solid #c2410c; box-shadow: 0 0 0 4px rgba(194,65,12,.12); }

/* No-site count box */
.no-site-box {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    border-color: #fdba74;
}
.no-site-box .balance-divider { background: #fdba74; }
.no-site-box .reset-balance-label { color: #c2410c; }
.no-site-count {
    font-family: 'Outfit', 'Heebo', sans-serif;
    font-size: 24px;
    font-weight: 800;
    color: #c2410c;
}

/* Bulk action toolbar */
.bulk-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #eff6ff;
    border: 1.5px solid #bfdbfe;
    border-radius: var(--radius);
    padding: 6px 14px;
    margin-bottom: 8px;
}
.bulk-count {
    font-size: 13px;
    font-weight: 600;
    color: #1d4ed8;
    margin-left: auto;
}

/* Row checkbox column */
.col-cb {
    width: 30px;
    text-align: center;
    padding: 0 4px !important;
}
.row-cb {
    cursor: pointer;
    width: 14px;
    height: 14px;
    accent-color: var(--primary);
}

/* Read-only amount inputs */
.readonly-amount {
    background: #f8fafc !important;
    color: #64748b !important;
    cursor: default !important;
    border-color: transparent !important;
}
.readonly-amount:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* ── Comment button ── */
.act-comment { color: #64748b; }
.act-comment.active,
.act-comment:hover { color: #3b82f6 !important; }

/* always visible when row has comments */
.act-comment.has-comments {
    opacity: 1 !important;
    color: #2563eb !important;
    background: #dbeafe !important;
}
.act-comment.has-comments svg {
    fill: #93c5fd;
    stroke: #2563eb;
}
.act-comment.active.has-comments,
.act-comment.has-comments:hover {
    background: #bfdbfe !important;
}

/* comment count badge */
.comment-badge {
    position: absolute;
    top: -5px;
    left: -5px;
    background: #2563eb;
    color: #fff;
    border-radius: 20px;
    font-size: 9px;
    font-weight: 700;
    min-width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
    pointer-events: none;
}
.act-btn { position: relative; }

/* ── Comments side panel ── */
.comments-panel {
    position: fixed;
    top: 0; left: 0;
    width: 340px;
    max-width: 95vw;
    height: 100vh;
    background: #fff;
    border-right: 2px solid #e2e8f0;
    box-shadow: 4px 0 24px rgba(0,0,0,.12);
    display: flex;
    flex-direction: column;
    z-index: 9989;
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    direction: rtl;
}
.comments-panel.open { transform: translateX(0); }

.comments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    flex-shrink: 0;
}
.comments-title {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
}
.comments-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #94a3b8;
    line-height: 1;
    padding: 0 4px;
}
.comments-close:hover { color: #475569; }

.comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.comment-item {
    background: #f1f5f9;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
}
.comment-item-new { background: #eff6ff; border: 1px solid #bfdbfe; }
.comment-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}
.comment-author {
    font-weight: 700;
    color: #1e293b;
    font-size: 12px;
}
.comment-time {
    color: #94a3b8;
    font-size: 11px;
}
.comment-text {
    color: #334155;
    line-height: 1.5;
    word-break: break-word;
}
.comment-empty, .comment-loading {
    color: #94a3b8;
    font-size: 13px;
    text-align: center;
    padding: 20px 0;
}

.comments-input-wrap {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    flex-shrink: 0;
    align-items: flex-end;
}
.comments-textarea {
    flex: 1;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 13px;
    resize: none;
    font-family: inherit;
    direction: rtl;
    transition: border-color .15s;
}
.comments-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}
.comments-send-btn {
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 10px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s;
}
.comments-send-btn:hover { background: #2563eb; }

/* ── Row with open comment panel (set via inline style + attr) ── */
.mizrahi-table tbody tr[data-comment-active],
.mizrahi-table tbody tr[data-comment-active]:hover,
.mizrahi-table tbody tr[data-comment-active]:nth-child(even),
.mizrahi-table tbody tr[data-comment-active]:nth-child(even):hover {
    background: #dbeafe !important;
    box-shadow: inset 4px 0 0 #2563eb !important;
    outline: 1.5px solid #93c5fd !important;
}

/* ── Row highlight after navigate ── */
@keyframes rowHighlight {
    0%  { background: #dbeafe; }
    70% { background: #dbeafe; }
    100%{ background: transparent; }
}
.row-highlight { animation: rowHighlight 2.5s ease-out forwards; }

/* ── Global Comments Drawer (right side) ── */
.gc-drawer {
    position: fixed;
    top: 0; right: 0;
    width: 380px;
    max-width: 96vw;
    height: 100vh;
    background: #fff;
    border-left: 2px solid #e2e8f0;
    box-shadow: -4px 0 24px rgba(0,0,0,.12);
    display: flex;
    flex-direction: column;
    z-index: 9989;
    transform: translateX(100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    direction: rtl;
}
.gc-drawer.open { transform: translateX(0); }

.gc-drawer-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    flex-shrink: 0;
}
.gc-drawer-title {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    flex-shrink: 0;
}

/* Tabs */
.gc-tabs {
    display: flex;
    gap: 4px;
    flex: 1;
    justify-content: center;
}
.gc-tab {
    background: none;
    border: 1.5px solid #e2e8f0;
    border-radius: 20px;
    padding: 3px 12px;
    font-size: 12px;
    cursor: pointer;
    color: #64748b;
    transition: all .15s;
}
.gc-tab-active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
    font-weight: 600;
}

/* Badge on topbar button */
.gc-badge {
    background: #ef4444;
    color: #fff;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    min-width: 16px;
    text-align: center;
    line-height: 1.4;
}
.gc-topbar-btn { position: relative; }

/* Thread list */
.gc-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gc-thread {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 11px 13px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.gc-thread:hover { border-color: #93c5fd; background: #eff6ff; }

.gc-thread-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 5px;
}
.gc-thread-row {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3;
}
.gc-doc {
    display: inline-block;
    background: #e0e7ff;
    color: #4338ca;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 6px;
}
.gc-thread-date {
    font-size: 11px;
    color: #94a3b8;
    flex-shrink: 0;
    margin-right: 8px;
}
.gc-thread-preview {
    font-size: 12px;
    color: #475569;
    margin-bottom: 7px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gc-thread-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #94a3b8;
}
.gc-thread-by { font-weight: 600; color: #64748b; }
.gc-thread-count {
    background: #f1f5f9;
    border-radius: 10px;
    padding: 1px 7px;
    color: #64748b;
}
.gc-resolve-btn {
    margin-right: auto;
    background: #f0fdf4;
    border: 1.5px solid #86efac;
    border-radius: 6px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #16a34a;
    transition: background .15s;
    flex-shrink: 0;
}
.gc-resolve-btn:hover { background: #dcfce7; }

/* Scrollable content area */
.mizrahi-scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding-bottom: 16px;
}

/* Table wrapper */
.table-scroll-wrapper {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    overflow-x: auto;
}

/*
 * In mizrahi-page flex layout, remove overflow so position:sticky on thead
 * works relative to .mizrahi-scroll (the actual scroll container).
 * overflow-x:auto on a wrapper implicitly makes overflow-y:auto too,
 * creating a nested scroll context that traps sticky elements.
 */
body.cashbook-page .table-scroll-wrapper {
    overflow: visible;
}

/* ═══════════════════════════════════════════
   MIZRAHI TABLE
═══════════════════════════════════════════ */
.mizrahi-table {
    direction: rtl;
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    table-layout: fixed;
}

/* Dark sticky header */
.mizrahi-table thead th {
    position: sticky;
    top: 0;
    background: var(--nav-bg);
    color: #dde3ed;
    z-index: 10;
    text-align: right;
    white-space: nowrap;
    border: none;
    padding: 11px 8px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .9px;
}

/* Rounded top corners of the dark header (RTL: first=right, last=left) */
.mizrahi-table thead th:first-child { border-radius: 0 var(--radius) 0 0; }
.mizrahi-table thead th:last-child  { border-radius: var(--radius) 0 0 0; }

/* Body rows */
.mizrahi-table tbody tr {
    border-bottom: 1px solid #f0f4ff;
    transition: background .1s;
}

.mizrahi-table tbody tr:last-child { border-bottom: none; }

.mizrahi-table tbody tr:hover { background: #f5f3ff; }

.mizrahi-table tbody tr:nth-child(even) { background: #fafbff; }
.mizrahi-table tbody tr:nth-child(even):hover { background: #f0ebff; }

.mizrahi-table td {
    border-bottom: none;
    padding: 3px 5px;
    text-align: right;
    direction: rtl;
}

.mizrahi-table input,
.mizrahi-table select {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    padding: 4px 5px;
    min-width: 80px;
    direction: rtl;
    text-align: right;
    font-family: 'Heebo', sans-serif;
    font-size: 13.5px;
    color: var(--text);
}

.mizrahi-table input:focus,
.mizrahi-table select:focus {
    background: #f5f3ff;
    border-radius: 5px;
    outline: 2px solid #c4b5fd;
    outline-offset: -1px;
}

.mizrahi-table input[type="number"] {
    direction: ltr;
    text-align: left;
}

/* Column widths */
.mizrahi-table th:nth-child(1),  .mizrahi-table td:nth-child(1)  { width: 90px; }
.mizrahi-table th:nth-child(2),  .mizrahi-table td:nth-child(2)  { width: 110px; }
.mizrahi-table th:nth-child(3),  .mizrahi-table td:nth-child(3)  { width: 115px; }
.mizrahi-table th:nth-child(4),  .mizrahi-table td:nth-child(4)  { width: 185px; }
.mizrahi-table th:nth-child(5),  .mizrahi-table td:nth-child(5)  { width: 185px; }
.mizrahi-table th:nth-child(6),  .mizrahi-table td:nth-child(6)  { width: 285px; }
.mizrahi-table th:nth-child(7),  .mizrahi-table td:nth-child(7)  { width: 105px; }
.mizrahi-table th:nth-child(8),  .mizrahi-table td:nth-child(8)  { width: 105px; }
.mizrahi-table th:nth-child(9),  .mizrahi-table td:nth-child(9)  { width: 120px; }
.mizrahi-table th:nth-child(10), .mizrahi-table td:nth-child(10) { width: 90px; }
.mizrahi-table th:nth-child(11), .mizrahi-table td:nth-child(11) { width: 285px; }
.mizrahi-table th:nth-child(12), .mizrahi-table td:nth-child(12) { width: 100px; }
.mizrahi-table th:nth-child(13), .mizrahi-table td:nth-child(13) { width: 120px; }
.mizrahi-table th:nth-child(14), .mizrahi-table td:nth-child(14) { width: 120px; }

/* Actions column */
.actions {
    white-space: nowrap;
    text-align: center !important;
    direction: ltr !important;
    width: 120px;
}

.act-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 4px 5px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .15s, background .12s, color .12s;
    color: var(--text-muted);
}

.mizrahi-table tbody tr:hover .act-btn { opacity: 1; }
.act-btn:hover    { background: #f1f5f9; }
.act-delete:hover { background: #fee2e2; color: var(--danger); }
.act-insert:hover { background: #d1fae5; color: var(--success); }
.act-dup:hover    { background: var(--primary-light); color: var(--primary); }

/* Balance column */
.balance {
    font-weight: 700;
    font-size: 13px;
    text-align: left !important;
    direction: ltr !important;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.3px;
    color: var(--text-muted);
}

.balance.pos { color: var(--success); }
.balance.neg { color: var(--danger); }

/* Flash states */
.mizrahi-table tbody tr.saved { background: #d1fae5 !important; transition: background 0s; }
.mizrahi-table tbody tr.error { background: #fee2e2 !important; }

/* Row select */
.row-select {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    padding: 3px 2px;
    direction: rtl;
    text-align: right;
    font-size: 13.5px;
    font-family: 'Heebo', sans-serif;
    cursor: pointer;
    color: var(--text);
}

/* TomSelect inside table */
.mizrahi-table .ts-wrapper { width: 100% !important; min-width: 0 !important; }

.mizrahi-table .ts-control {
    min-height: 24px;
    padding: 2px 4px;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

.ts-wrapper, .ts-control, .ts-dropdown {
    direction: rtl;
    text-align: right;
    font-family: 'Heebo', sans-serif;
}

/* Filter icons (in dark header) */
.filter-icon {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 2px 3px;
    color: rgba(255,255,255,.28);
    vertical-align: middle;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    opacity: 0;
    transition: opacity .15s, color .12s, background .12s;
}

.mizrahi-table thead th:hover .filter-icon,
.mizrahi-table thead th .filter-icon.open { opacity: 1; }

.filter-icon:hover { color: #c4b5fd; background: rgba(124,58,237,.28); }
.filter-icon.open  { color: #a78bfa; background: rgba(124,58,237,.32); }
.filter-icon.open svg { fill: rgba(167,139,250,.22); }

/* Sort buttons */
.sort-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    color: rgba(255,255,255,.45);
    font-size: 11px;
    padding: 2px 3px;
    border-radius: 4px;
    line-height: 1;
    opacity: 0;
    transition: opacity .15s, color .12s, background .12s;
}
.mizrahi-table thead th:hover .sort-btn,
.sort-btn.sort-active { opacity: 1; }
.sort-btn.sort-active { color: #60a5fa; }
.sort-btn:hover { color: #c4b5fd; background: rgba(124,58,237,.28); }

/* Filter dropdown panel */
.excel-filter {
    display: none;
    position: absolute;
    background: white;
    border: 1.5px solid var(--border-dark);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-sm);
    padding: 12px;
    z-index: 9999;
    min-width: 280px;
    max-width: 420px;
    width: max-content;
}

.excel-filter.open { display: block; }

.excel-filter input, .excel-filter select {
    width: 100%;
    margin-bottom: 5px;
    font-family: 'Heebo', sans-serif;
    border: 1.5px solid var(--border-dark);
    border-radius: var(--radius-sm);
    padding: 7px 11px;
    font-size: 13px;
    background: var(--surface-2);
}

.excel-filter input[type="date"],
.excel-filter input[type="number"] {
    width: 130px !important;
    display: inline-block;
}

.range-filter {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
}

.range-filter input { width: 130px !important; min-width: 130px !important; }

/* Hide filter-select before TomSelect loads */
select.filter-select { visibility: hidden; }
.ts-wrapper { visibility: visible; }

/* Hide native select arrows in table; reveal on row hover */
.mizrahi-table td select { -webkit-appearance: none; -moz-appearance: none; appearance: none; cursor: pointer; }
.mizrahi-table tbody tr:hover td select { -webkit-appearance: auto; -moz-appearance: auto; appearance: auto; }

/* ═══════════════════════════════════════════
   Pagination
═══════════════════════════════════════════ */
.pager {
    margin-top: 16px;
    text-align: center;
    direction: ltr;
    padding-bottom: 10px;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    margin: 2px;
    border: 1.5px solid var(--border-dark);
    border-radius: 20px;
    text-decoration: none;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}

.page-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 2px 8px var(--primary-glow);
}

.page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(124,58,237,.38);
}

.page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 34px;
    margin: 2px;
    color: var(--text-muted);
    font-size: 15px;
    letter-spacing: 1px;
    user-select: none;
}

/* Add row button */
.add-row-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 8px 22px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Heebo', sans-serif;
    cursor: pointer;
    transition: background .15s, box-shadow .15s;
    box-shadow: 0 2px 8px rgba(124,58,237,.34);
}

.add-row-btn:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 14px rgba(124,58,237,.44);
}

/* ═══════════════════════════════════════════
   INDEX PAGE (Sites / EntryTypes)
═══════════════════════════════════════════ */
.page-wrap {
    max-width: 860px;
    margin: 0 auto;
    text-align: center;
    font-family: 'Heebo', sans-serif;
}

.plus-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    font-size: 26px;
    cursor: pointer;
    margin-bottom: 16px;
    box-shadow: 0 2px 10px rgba(124,58,237,.38);
    transition: background .15s, box-shadow .15s;
    line-height: 1;
}

.plus-btn:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 16px rgba(124,58,237,.5);
}

.add-card {
    margin: 0 auto 22px auto;
    padding: 20px 24px;
    max-width: 440px;
    border: 1.5px solid var(--border-dark);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    text-align: right;
}

.filters {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    background: var(--surface);
    padding: 14px 18px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.multi-select {
    min-width: 240px;
    height: 80px;
    text-align: right;
    border: 1.5px solid var(--border-dark);
    border-radius: var(--radius-sm);
    padding: 4px;
    font-family: 'Heebo', sans-serif;
}

.sites-table {
    margin: 0 auto;
    border-collapse: separate;
    border-spacing: 0 6px;
    width: 100%;
    direction: rtl;
}

.sites-table tr { background: transparent; }

.sites-table td {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 10px 12px;
    transition: box-shadow .12s;
}

.sites-table td:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.sites-table td:last-child  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.sites-table tr:hover td { box-shadow: var(--shadow-sm); border-color: var(--border-dark); }

.row-form {
    display: grid;
    grid-template-columns: 1fr 70px 70px 40px;
    gap: 12px;
    align-items: center;
    direction: rtl;
}

.name-input, .text-input {
    padding: 8px 12px;
    border: 1.5px solid var(--border-dark);
    border-radius: var(--radius-sm);
    text-align: right;
    font-family: 'Heebo', sans-serif;
    font-size: 14px;
    transition: border-color .15s;
}

.name-input:focus, .text-input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.switch-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
    font-size: 14px;
    font-weight: 500;
}

/* Toggle switch */
.toggle input { display: none; }

.toggle span {
    display: inline-block;
    width: 44px;
    height: 22px;
    background: #cbd5e1;
    border-radius: 20px;
    position: relative;
    cursor: pointer;
    transition: background .2s;
}

.toggle span::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    top: 2px;
    right: 2px;
    background: white;
    border-radius: 50%;
    transition: right .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.toggle input:checked + span { background: var(--success); }
.toggle input:checked + span::before { right: 24px; }

.save-btn, .save-small, .filter-btn {
    padding: 7px 16px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--primary);
    cursor: pointer;
    background: var(--primary);
    color: white;
    font-family: 'Heebo', sans-serif;
    font-weight: 600;
    font-size: 13px;
    transition: background .15s;
}

.save-btn:hover, .save-small:hover, .filter-btn:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.clear-btn {
    padding: 7px 16px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-dark);
    cursor: pointer;
    background: var(--surface);
    color: var(--text-muted);
    font-family: 'Heebo', sans-serif;
    font-weight: 500;
    font-size: 13px;
    text-decoration: none;
    transition: border-color .15s, color .15s;
}

.clear-btn:hover { border-color: var(--primary); color: var(--primary); }

.delete-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 4px;
    transition: background .12s, color .12s;
}

.delete-btn:hover { background: #fee2e2; color: var(--danger); }

/* ═══════════════════════════════════════════
   CONTAINER OVERRIDE (full width for Mizrahi)
═══════════════════════════════════════════ */
.container {
    max-width: none !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* ═══════════════════════════════════════════
   SITE REPORT PAGE
═══════════════════════════════════════════ */
body.report-page .site-body {
    height: calc(100vh - 62px);
    min-height: unset;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0 28px;
}

body.report-page .site-body > main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

body.report-page .table-scroll-wrapper { overflow: visible; }

.report-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    padding: 10px 0 8px;
    background: var(--bg);
    z-index: 20;
    flex-wrap: wrap;
}

.report-title-wrap {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-shrink: 0;
}

.report-title-icon {
    width: 22px;
    height: 22px;
    color: var(--primary);
    flex-shrink: 0;
}

.report-filter-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    flex-wrap: wrap;
}

.report-site-select {
    min-width: 260px;
    max-width: 480px;
    font-family: 'Heebo', sans-serif;
    font-size: 14px;
    border: 1.5px solid var(--border-dark);
    border-radius: var(--radius-sm);
    padding: 6px 11px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

.date-range-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--surface);
    border: 1.5px solid var(--border-dark);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
}

.report-date-input {
    border: none;
    outline: none;
    background: transparent;
    font-family: 'Outfit', 'Heebo', sans-serif;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    padding: 0;
}

.date-sep { color: var(--text-light); font-size: 13px; user-select: none; }

.report-submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Heebo', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, box-shadow .15s;
    box-shadow: 0 2px 8px rgba(124,58,237,.3);
}

.report-submit-btn:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 14px rgba(124,58,237,.4);
}

.print-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 16px;
    background: var(--surface);
    color: var(--text-muted);
    border: 1.5px solid var(--border-dark);
    border-radius: var(--radius-sm);
    font-family: 'Heebo', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
    flex-shrink: 0;
}

.print-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* Print-only header */
.print-header {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 0 0 12px;
    border-bottom: 2px solid var(--border-dark);
    margin-bottom: 14px;
}

.print-header-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
}

.print-header-meta {
    font-size: 12px;
    color: var(--text-muted);
}

/* Summary section */
.report-summary {
    flex-shrink: 0;
    padding-bottom: 8px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}

.metric-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 8px 10px 8px;
    border: 1.5px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: relative;
    overflow: hidden;
}

.metric-card::after {
    content: '';
    position: absolute;
    top: 0; right: 0; left: 0;
    height: 3px;
    border-radius: var(--radius) var(--radius) 0 0;
}

.metric-card.income::after        { background: var(--success); }
.metric-card.expense::after        { background: var(--danger); }
.metric-card.profit::after         { background: var(--primary); }
.metric-card.workers::after        { background: var(--warning); }
.metric-card.workers-total::after  { background: #b45309; }
.metric-card.vat::after            { background: #0284c7; }
.metric-card.tzedaka::after        { background: #7c3aed; }
.metric-card.profit-after::after   { background: #059669; }

.metric-card.workers-total {
    border-color: #fde68a;
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
}
.metric-card.vat {
    border-color: #bae6fd;
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
}
.metric-card.tzedaka {
    border-color: #ddd6fe;
    background: linear-gradient(135deg, #f5f3ff, #ede9fe);
}
.metric-card.profit-after {
    border-color: #a7f3d0;
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
}

.metric-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.metric-value {
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -.3px;
    color: var(--text);
    direction: ltr;
    text-align: left;
}

.metric-card.income  .metric-value            { color: var(--success); }
.metric-card.expense .metric-value            { color: var(--danger); }
.metric-card.profit  .metric-value.pos        { color: var(--success); }
.metric-card.profit  .metric-value.neg        { color: var(--danger); }
.metric-card.workers .metric-value                { color: var(--warning); }
.metric-card.workers-total .metric-value          { color: #92400e; }
.metric-card.vat .metric-value                    { color: #0284c7; }
.metric-card.tzedaka .metric-value                { color: #7c3aed; }
.metric-card.profit-after .metric-value.pos       { color: var(--success); }
.metric-card.profit-after .metric-value.neg       { color: var(--danger); }

.metric-pct {
    font-family: 'Outfit', sans-serif;
    font-size: 9.5px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 20px;
    display: inline-block;
    width: fit-content;
}

.metric-card.income  .metric-pct            { background: rgba(5,150,105,.1);   color: var(--success); }
.metric-card.expense .metric-pct            { background: rgba(220,38,38,.1);   color: var(--danger); }
.metric-card.profit  .metric-pct.pos        { background: rgba(5,150,105,.1);   color: var(--success); }
.metric-card.profit  .metric-pct.neg        { background: rgba(220,38,38,.1);   color: var(--danger); }
.metric-card.workers .metric-pct            { background: rgba(217,119,6,.1);   color: var(--warning); }
.metric-card.workers-total .metric-pct      { background: rgba(180,83,9,.12);   color: #92400e; }
.metric-card.vat .metric-pct               { background: rgba(2,132,199,.1);   color: #0284c7; }
.metric-card.tzedaka .metric-pct           { background: rgba(124,58,237,.1);  color: #7c3aed; }
.metric-card.profit-after .metric-pct.pos  { background: rgba(5,150,105,.1);   color: var(--success); }
.metric-card.profit-after .metric-pct.neg  { background: rgba(220,38,38,.1);   color: var(--danger); }

.metric-pcts {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 2px;
}

/* Analytics chips */
.analytics-strip {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.analytics-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
}

.chip-label { color: var(--text-muted); font-weight: 500; }

.chip-value {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    color: var(--text);
}

.chip-green { color: var(--success); }
.chip-red   { color: var(--danger); }
.chip-amber { color: var(--warning); }
.chip-blue  { color: #3b82f6; }

.analytics-chip.chip-good { border-color: rgba(5,150,105,.3); background: rgba(5,150,105,.05); }
.analytics-chip.chip-good .chip-value { color: var(--success); }
.analytics-chip.chip-bad  { border-color: rgba(220,38,38,.3); background: rgba(220,38,38,.05); }
.analytics-chip.chip-bad  .chip-value { color: var(--danger); }

/* Report scroll area */
.report-scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding-bottom: 16px;
}

/* Report table column widths (10 cols: assign + מקור + 8) */
.report-table th:nth-child(1), .report-table td:nth-child(1) { width: 36px; text-align: center; }
.report-table th:nth-child(2), .report-table td:nth-child(2) { width: 72px; }
.report-table th:nth-child(3), .report-table td:nth-child(3) { width: 95px; }
.report-table th:nth-child(4), .report-table td:nth-child(4) { width: 190px; }
.report-table th:nth-child(5), .report-table td:nth-child(5) { width: auto; }
.report-table th:nth-child(6), .report-table td:nth-child(6) { width: 155px; }
.report-table th:nth-child(7), .report-table td:nth-child(7) { width: 100px; }
.report-table th:nth-child(8), .report-table td:nth-child(8) { width: 100px; }
.report-table th:nth-child(9), .report-table td:nth-child(9) { width: 115px; }
.report-table th:nth-child(10), .report-table td:nth-child(10) { width: 90px; }

/* Assign-site button */
.assign-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    opacity: .55;
    padding: 3px 5px;
    border-radius: 6px;
    line-height: 1;
    transition: opacity .15s, background .15s, color .15s;
}
.assign-btn:hover { opacity: 1; background: rgba(139,92,246,.1); color: var(--primary); }

/* Hidden on screen, shown only when printing */
.print-only-notes { display: none; }

/* Site reassign popup */
.site-popup {
    position: fixed;
    z-index: 9999;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 28px rgba(0,0,0,.18);
    width: 240px;
    display: none;
    flex-direction: column;
    overflow: hidden;
}
.site-popup-search {
    width: 100%;
    box-sizing: border-box;
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 9px 12px;
    font-size: 13px;
    font-family: 'Heebo', sans-serif;
    background: var(--surface);
    color: var(--text);
    outline: none;
    direction: rtl;
}
.site-popup-search::placeholder { color: var(--text-muted); }
.site-popup-list {
    max-height: 220px;
    overflow-y: auto;
    padding: 4px 0;
}
.site-popup-item {
    padding: 7px 13px;
    font-size: 13px;
    font-family: 'Heebo', sans-serif;
    cursor: pointer;
    color: var(--text);
    direction: rtl;
    transition: background .1s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.site-popup-item:hover { background: rgba(139,92,246,.1); color: var(--primary); }
.site-popup-empty { padding: 10px 13px; font-size: 12px; color: var(--text-muted); text-align: center; }

/* Split row */
.split-row {
    display: grid;
    grid-template-columns: 1fr 130px 130px 90px 90px 28px;
    gap: 6px;
    align-items: center;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
}
.split-row input, .split-row select {
    width: 100%; padding: 4px 7px; border: 1px solid var(--border);
    border-radius: 6px; font-size: 13px; direction: rtl;
}
.sp-remove {
    background: none; border: none; cursor: pointer; color: #94a3b8;
    font-size: 16px; line-height: 1; padding: 0;
}
.sp-remove:hover { color: var(--danger); }
.act-split { color: #7c3aed; opacity: 0.6; }
.act-split:hover { background: #ede9fe; color: var(--primary); opacity: 1; }
.mizrahi-table tbody tr:hover .act-split { opacity: 1; }

/* Read-only cells */
.ro-cell {
    color: var(--text);
    padding: 4px 7px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.date-cell {
    font-family: 'Outfit', sans-serif;
    font-size: 12.5px;
    color: var(--text-muted);
}

/* Editable cells — subtle purple tint */
.editable-cell { background: rgba(124,58,237,.03); }
.editable-cell input:focus,
.editable-cell select:focus { background: #f5f3ff !important; }

/* Amount cells */
.amount-cell {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 13px;
    direction: ltr;
    text-align: left !important;
}

.exp-val { color: var(--danger); }
.inc-val  { color: var(--success); }

/* Source badge */
.source-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.source-cell { text-align: center !important; }
.src-m { background: rgba(124,58,237,.13); color: var(--primary); }
.src-p { background: rgba(5,150,105,.13);  color: var(--success); }

/* Empty state */
.report-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-muted);
}

.empty-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.empty-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

/* ═══════════════════════════════════════════
   PRINT
═══════════════════════════════════════════ */
@media print {
    /* Hide nav, filters, buttons */
    .site-nav, .report-topbar, .no-print, .analytics-strip { display: none !important; }

    /* Reset flex layout so page flows naturally */
    html, body { height: auto !important; overflow: visible !important; background: white !important; }
    body.report-page .site-body {
        height: auto !important; overflow: visible !important;
        display: block !important; padding: 0 !important;
    }
    body.report-page .site-body > main {
        display: block !important; overflow: visible !important; flex: none !important;
    }
    .report-summary { display: block !important; flex-shrink: unset !important; break-inside: avoid; }
    .report-scroll  { overflow: visible !important; height: auto !important; flex: none !important; display: block !important; }
    .table-scroll-wrapper { overflow: visible !important; box-shadow: none !important; border: 1px solid #ddd !important; }

    /* Print-only header */
    .print-header { display: flex !important; margin-bottom: 12px; }

    /* Summary cards — 3 per row, compact */
    .metrics-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px !important;
        margin-bottom: 10px !important;
    }
    .metric-card  { box-shadow: none !important; border: 1px solid #ccc !important; padding: 8px 10px !important; break-inside: avoid; }
    .metric-value { font-size: 15px !important; }

    /* Table — remove sticky, shrink font, repeat header */
    .mizrahi-table { font-size: 10.5px !important; width: 100% !important; }
    .mizrahi-table thead th {
        position: static !important;
        background: #eef2ff !important;
        color: #333 !important;
        font-size: 9px !important;
        padding: 6px 5px !important;
    }
    thead { display: table-header-group; }  /* repeat header on every page */

    /* Clean up cells */
    .ro-cell, .editable-cell { background: white !important; }
    .editable-cell input, .editable-cell .ts-wrapper, .editable-cell select { display: none !important; }
    .print-only-notes { display: inline !important; font-size: 10.5px; color: #222; }
    .amount-cell { font-size: 10.5px !important; }
    .balance { font-size: 10.5px !important; }

    /* Summary cards — 4 per row in print */
    .metrics-grid { grid-template-columns: repeat(4, 1fr) !important; }

    /* Page breaks */
    .report-summary { page-break-after: avoid; }

    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@page { size: A4 landscape; margin: 12mm 10mm; }

/* Import button */
.import-btn { color: var(--primary) !important; border-color: #c4b5fd !important; background: #f5f3ff !important; }
.import-btn:hover { background: var(--primary-light) !important; border-color: var(--primary) !important; }

/* Import messages */
.import-msg {
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    flex-shrink: 0;
}
.import-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.import-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* ═══════════════════════════════════════════
   PAGI TABLE – 10-column widths
   1:פעולות  2:תאריך אסמכתא  3:אתר  4:סוג
   5:ספק  6:הוצאה  7:הכנסה  8:יתרה
   9:הערות  10:תאריך שינוי
═══════════════════════════════════════════ */
.pagi-table th:nth-child(1),  .pagi-table td:nth-child(1)  { width: 90px; }
.pagi-table th:nth-child(2),  .pagi-table td:nth-child(2)  { width: 120px; }
.pagi-table th:nth-child(3),  .pagi-table td:nth-child(3)  { width: 160px; }
.pagi-table th:nth-child(4),  .pagi-table td:nth-child(4)  { width: 160px; }
.pagi-table th:nth-child(5),  .pagi-table td:nth-child(5)  { width: 240px; }
.pagi-table th:nth-child(6),  .pagi-table td:nth-child(6)  { width: 110px; }
.pagi-table th:nth-child(7),  .pagi-table td:nth-child(7)  { width: 110px; }
.pagi-table th:nth-child(8),  .pagi-table td:nth-child(8)  { width: 120px; }
.pagi-table th:nth-child(9),  .pagi-table td:nth-child(9)  { width: auto; }
.pagi-table th:nth-child(10), .pagi-table td:nth-child(10) { width: 120px; }

/* ── Logout button ── */
.nav-logout-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 7px;
    color: rgba(255,255,255,0.8);
    font-size: 13px;
    font-weight: 500;
    padding: 5px 12px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.nav-logout-btn:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}
