/* ════════════════════════════════════════
   invoice.css — Invoices & Vouchers
   Najeeda Corporate Services
   ════════════════════════════════════════ */
.inv-wrap, .vou-wrap {
    background: white; padding: 32px;
    border: 1px solid var(--gray-200);
    border-radius: 10px; font-size: 0.88rem;
    direction: ltr; text-align: left;
}

/* Header */
.inv-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 6px; padding-bottom: 18px;
    border-bottom: 3px solid var(--primary);
}
.inv-logo-area { display: flex; align-items: center; gap: 14px; }
.inv-logo {
    width: 72px; height: 72px; border-radius: 12px;
    overflow: hidden; border: 1px solid var(--gray-200);
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; flex-shrink: 0;
}
.inv-logo img { width:100%; height:100%; object-fit:cover; }
.inv-co-name { color: var(--primary); font-size: 0.95rem; font-weight: 800; margin-bottom: 2px; }
.inv-co-sub  { font-size: 0.78rem; color: var(--gray-500); margin-bottom: 4px; }
.inv-co-info { font-size: 0.75rem; color: var(--gray-400); line-height: 1.6; }
.inv-co-info span { margin-right: 10px; }

.inv-title-area { text-align: right; }
.inv-title-area h1 { font-size: 1.9rem; font-weight: 900; color: var(--primary); letter-spacing: 3px; }
.inv-num   { font-size: 0.78rem; color: var(--gray-500); margin-top: 4px; }
.inv-date  { font-size: 0.74rem; color: var(--gray-400); margin-top: 2px; }
.inv-status-paid  { display:inline-block; background:#d1fae5; color:#065f46; padding:3px 14px; border-radius:20px; font-weight:700; font-size:0.78rem; margin-top:6px; border:1px solid #6ee7b7; }
.inv-status-draft { display:inline-block; background:#fef3c7; color:#92400e; padding:3px 14px; border-radius:20px; font-weight:700; font-size:0.78rem; margin-top:6px; border:1px solid #fcd34d; }

/* ── Centered document title ── */
.inv-doc-title {
    text-align: center;
    font-size: 1.55rem;
    font-weight: 900;
    letter-spacing: 5px;
    color: var(--primary);
    padding: 12px 0 14px;
    margin-bottom: 18px;
    text-transform: uppercase;
}

.inv-parties { display: grid; grid-template-columns: 1fr 1fr auto; gap: 20px; margin-bottom: 20px; background: var(--gray-50); border-radius: 8px; padding: 14px 16px; border: 1px solid var(--gray-200); align-items: start; }
.inv-party h4 { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 2px; color: var(--gray-400); margin-bottom: 6px; font-weight: 700; }
.inv-party-name { font-weight: 800; font-size: 0.92rem; color: var(--gray-900); margin-bottom: 3px; }
.inv-party p  { font-size: 0.82rem; line-height: 1.7; color: var(--gray-600); }

.inv-note { background: #fffbeb; border-left: 4px solid var(--accent); padding: 8px 14px; border-radius: 0 8px 8px 0; font-size: 0.8rem; color: #78350f; margin-bottom: 18px; }

/* Invoice table */
.inv-table { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
.inv-table th { background: var(--primary); color: white; padding: 10px 14px; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.8px; font-weight: 700; }
.inv-table td { padding: 10px 14px; border-bottom: 1px solid var(--gray-100); font-size: 0.86rem; }
.inv-table .inv-row-alt td { background: var(--gray-50); }
.inv-table tr:last-child td { border-bottom: none; }

/* Totals */
.inv-totals { margin-bottom: 20px; max-width: 300px; margin-left: auto; margin-right: 0; }
.inv-tr { display: flex; justify-content: space-between; padding: 5px 0; font-size: 0.86rem; border-bottom: 1px dashed var(--gray-200); color: var(--gray-600); }
.inv-tr.grand { font-weight: 900; font-size: 1.05rem; color: var(--primary); border-top: 2px solid var(--primary); border-bottom: none; padding-top: 10px; margin-top: 4px; }
.inv-tr.tax   { color: var(--gray-500); }
.inv-tr.paid  { color: var(--success); font-weight: 600; border-bottom: none; }
.inv-tr.due   { color: var(--danger); font-weight: 700; border-bottom: none; }

/* Bank details */
.inv-bank { background: #f0fdf4; border-radius: 8px; padding: 14px 16px; margin-bottom: 18px; border: 1px solid #bbf7d0; }
.inv-bank h4 { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--primary); margin-bottom: 10px; font-weight: 700; }
.inv-bank-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ibl { color: var(--gray-400); display: block; font-size: 0.68rem; margin-bottom: 2px; text-transform: uppercase; letter-spacing: 0.5px; }
.inv-bank-item strong { font-size: 0.82rem; color: var(--gray-900); }

/* Notes */
.inv-notes-box { background: var(--gray-50); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-size: 0.85rem; border: 1px solid var(--gray-200); }
.inv-notes-box strong { color: var(--primary); display: block; margin-bottom: 4px; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 1px; }
.inv-notes-box p { color: var(--gray-600); line-height: 1.6; }

/* Signatures */
.inv-sigs { display: flex; justify-content: space-around; align-items: flex-end; margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--gray-200); }
.inv-sig { text-align: center; min-width: 150px; }
.inv-sig-line { height: 56px; border-bottom: 2px solid var(--primary); margin-bottom: 6px; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; padding-bottom: 3px; }
.inv-sig-line img { max-height: 52px; max-width: 140px; object-fit: contain; }
.inv-sig p { font-size: 0.7rem; color: var(--gray-400); text-transform: uppercase; letter-spacing: 1px; }
.inv-stamp-box { text-align: center; }
.stamp-circle { width: 80px; height: 80px; border-radius: 50%; border: 2px dashed var(--gray-300); margin: 0 auto 6px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.stamp-circle img { width:100%; height:100%; object-fit:cover; }
.stamp-label { font-size: 0.7rem; color: var(--gray-400); text-transform: uppercase; letter-spacing: 1px; }

.inv-footer { text-align: center; margin-top: 22px; font-size: 0.74rem; color: var(--gray-400); padding-top: 14px; border-top: 1px solid var(--gray-100); line-height: 1.8; }

/* Invoice print controls bar */
.inv-controls {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
    background: var(--gray-50); padding: 12px 14px; border-radius: var(--radius); margin-bottom: 14px;
    border: 1px solid var(--gray-200);
}
.inv-controls label { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.inv-ctrl-input {
    padding: 8px 12px; border: 2px solid var(--gray-200); border-radius: 8px;
    font-family: inherit; font-size: 0.84rem; outline: none;
}
.inv-ctrl-input:focus { border-color: var(--primary); }

/* Standalone form section */
.inv-form-section { background: var(--gray-50); border-radius: 10px; padding: 16px; margin-bottom: 14px; border: 1px solid var(--gray-200); }
.inv-form-section h4 { font-size: 0.78rem; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; }

/* ── Items Editor ── */
.inv-items-wrap { margin-bottom: 16px; }
.inv-items-hd {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px;
}
.inv-items-tbl { width: 100%; border-collapse: collapse; }
.inv-items-tbl th {
    background: var(--primary); color: white; padding: 8px 10px;
    font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.6px; font-weight: 700;
}
.inv-items-tbl td { padding: 4px 4px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.inv-items-tbl tr:last-child td { border-bottom: none; }
.inv-fi {
    width: 100%; padding: 7px 9px; border: 1.5px solid var(--gray-200); border-radius: 6px;
    font-family: inherit; font-size: 0.84rem; outline: none; background: white;
}
.inv-fi:focus { border-color: var(--primary); }
.inv-fi[readonly] { background: var(--gray-50); color: var(--gray-500); cursor: default; }
.inv-fi-num { text-align: right; }
.inv-row-total { text-align: right; font-weight: 700; font-size: 0.86rem; padding: 4px 10px; color: var(--primary); }
.inv-rm-btn {
    background: none; border: 1.5px solid var(--danger); color: var(--danger);
    border-radius: 6px; width: 28px; height: 28px; cursor: pointer; font-size: 1rem;
    display: flex; align-items: center; justify-content: center; transition: var(--tr);
}
.inv-rm-btn:hover { background: var(--danger); color: white; }

/* ── Voucher — New Professional Design ── */

/* Document Title */
.vou-doc-title {
    text-align: center;
    padding: 16px 0 10px;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 18px;
}
.vou-title-en {
    font-size: 1.5rem; font-weight: 900; letter-spacing: 6px;
    color: var(--primary); text-transform: uppercase;
}
.vou-title-ar {
    font-size: 1rem; font-weight: 700; color: var(--accent);
    letter-spacing: 2px; margin-top: 2px;
    font-family: 'Tajawal', Arial, sans-serif;
}

/* Parties bar */
.vou-parties-bar {
    display: flex; align-items: stretch; gap: 0;
    background: #f8fafc; border-radius: 10px;
    border: 1px solid #e2e8f0; margin-bottom: 20px;
    overflow: hidden;
}
.vou-pb-col {
    flex: 1; padding: 14px 18px;
}
.vou-pb-center { text-align: center; border-left: 1px solid #e2e8f0; border-right: 1px solid #e2e8f0; }
.vou-pb-right  { text-align: right; }
.vou-pb-divider { width: 1px; background: #e2e8f0; }
.vou-pb-label {
    font-size: 0.68rem; text-transform: uppercase; letter-spacing: 1.5px;
    color: #94a3b8; font-weight: 700; margin-bottom: 5px;
}
.vou-pb-val { font-size: 0.9rem; color: #1e293b; font-weight: 600; }
.vou-pb-val.strong { font-weight: 800; color: var(--primary); }
.vou-num-big {
    font-size: 1.05rem; font-weight: 900; color: var(--primary);
    letter-spacing: 1px;
}

/* Details section */
.vou-details-section {
    background: #fff; border: 1px solid #e2e8f0;
    border-radius: 10px; margin-bottom: 20px; overflow: hidden;
}
.vou-ds-title {
    background: var(--primary); color: white;
    font-size: 0.72rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: 2px;
    padding: 10px 18px;
}
.vou-ds-grid { padding: 4px 0; }
.vou-ds-row {
    display: grid; grid-template-columns: 28px 1fr 1fr;
    align-items: center; gap: 8px;
    padding: 12px 18px; border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}
.vou-ds-row:last-child { border-bottom: none; }
.vou-ds-row:hover { background: #fafbfc; }
.vou-ds-icon { font-size: 1rem; text-align: center; }
.vou-ds-label { font-size: 0.82rem; color: #64748b; font-weight: 600; }
.vou-ds-val { font-size: 0.9rem; font-weight: 700; color: #1e293b; text-align: right; }

/* Amount Box */
.vou-amount-box {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary) 60%, #0a4520 100%);
    color: white; border-radius: 12px; text-align: center;
    padding: 28px 24px; margin-bottom: 24px;
    position: relative; overflow: hidden;
}
.vou-amount-box::before {
    content: ''; position: absolute; top: -40px; right: -40px;
    width: 120px; height: 120px; border-radius: 50%;
    background: rgba(255,255,255,0.05);
}
.vou-amount-box::after {
    content: ''; position: absolute; bottom: -30px; left: -30px;
    width: 90px; height: 90px; border-radius: 50%;
    background: rgba(255,255,255,0.06);
}
.vab-label {
    font-size: 0.78rem; opacity: 0.8; margin-bottom: 10px;
    text-transform: uppercase; letter-spacing: 2px;
}
.vab-amount {
    font-size: 2.4rem; font-weight: 900; letter-spacing: 1px;
    line-height: 1.1;
}
.vab-cur { font-size: 1.3rem; font-weight: 700; margin-left: 6px; opacity: 0.9; }
.vab-words {
    font-size: 0.85rem; opacity: 0.85; margin-top: 10px;
    font-family: 'Tajawal', Arial, sans-serif; font-weight: 600;
    border-top: 1px solid rgba(255,255,255,0.2);
    padding-top: 8px; margin-top: 12px;
}

/* Keep old class names as fallback */
.vou-header { display: none; }
.vou-row { display: none; }
.vou-amount { display: none; }

/* ════════════════════════════════════════
   Financial Module — Invoice Management
   ════════════════════════════════════════ */

/* ── Badge variants for invoice statuses ── */
.badge-success   { background: var(--success-bg); color: var(--success-text); }
.badge-warning   { background: var(--warning-bg); color: var(--warning-text); }
.badge-danger    { background: var(--danger-bg);  color: var(--danger-text); }
.badge-secondary { background: var(--gray-100);   color: var(--gray-600); }
.badge-info      { background: #dbeafe;            color: #1e40af; }
.badge-dark      { background: #1e293b;            color: #e2e8f0; }
.badge-primary   { background: var(--primary-bg, #d1fae5); color: var(--primary); }

/* ── btn-xs ── */
.btn-xs { padding: 2px 8px; font-size: 0.72rem; border-radius: 6px; }

/* ── Invoice list table ── */
.finv-table { width: 100%; }
.finv-table td, .finv-table th { vertical-align: middle; }

/* ── Items editor header row ── */
.finv-items-header {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 4px; background: var(--gray-50);
    border: 1px solid var(--gray-200); border-radius: 8px 8px 0 0;
    font-size: 0.72rem; font-weight: 700; color: var(--gray-500);
    text-transform: uppercase; letter-spacing: 0.5px;
}
.finv-col-desc  { flex: 3; padding-right: 8px; }
.finv-col-qty   { width: 70px; text-align: center; }
.finv-col-price { width: 100px; text-align: center; }
.finv-col-tax   { width: 70px; text-align: center; }
.finv-col-total { width: 90px; text-align: center; }

/* ── Items editor rows ── */
.finv-item-row {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 4px; border: 1px solid var(--gray-200);
    border-top: none; background: white;
    transition: background 0.15s;
}
.finv-item-row:hover { background: var(--gray-50); }
.finv-item-row:last-child { border-radius: 0 0 8px 8px; }
.finv-item-desc {
    flex: 3;
    padding: 7px 10px; border: 1.5px solid var(--gray-200);
    border-radius: 6px; font-family: inherit; font-size: 0.84rem;
    outline: none; background: white; width: 100%;
}
.finv-item-desc:focus { border-color: var(--primary); }
.finv-item-qty, .finv-item-price, .finv-item-tax {
    padding: 7px 6px; border: 1.5px solid var(--gray-200);
    border-radius: 6px; font-family: inherit; font-size: 0.84rem;
    outline: none; text-align: center; background: white;
}
.finv-item-qty   { width: 70px; }
.finv-item-price { width: 100px; }
.finv-item-tax   { width: 70px; }
.finv-item-qty:focus, .finv-item-price:focus, .finv-item-tax:focus { border-color: var(--primary); }
.finv-item-line-total {
    width: 90px; text-align: center; font-weight: 700;
    font-size: 0.88rem; color: var(--primary); padding: 0 4px;
}
.finv-item-remove {
    width: 28px; height: 28px; padding: 0;
    border: 1.5px solid var(--danger); background: none;
    color: var(--danger); border-radius: 6px;
    cursor: pointer; font-size: 1rem; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: var(--tr);
}
.finv-item-remove:hover { background: var(--danger); color: white; }

/* ── Totals summary box ── */
.finv-totals-box {
    background: var(--gray-50); border: 1px solid var(--gray-200);
    border-radius: 10px; padding: 14px 20px;
    max-width: 360px; margin-left: auto;
}
.ftb-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 0; border-bottom: 1px dashed var(--gray-200);
    font-size: 0.86rem; color: var(--gray-600);
}
.ftb-row:last-child { border-bottom: none; }
.ftb-total {
    font-weight: 900; font-size: 1rem;
    color: var(--primary); border-top: 2px solid var(--primary);
    border-bottom: none; margin-top: 6px; padding-top: 10px;
}
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger)  !important; }

/* ── Selected badge (customer search) ── */
.selected-badge {
    display: flex; align-items: center; gap: 8px;
    background: #f0fdf4; border: 1.5px solid #86efac;
    border-radius: 10px; padding: 8px 14px; margin-bottom: 10px;
}
.sel-badge-name { font-weight: 700; color: var(--primary); }
.sel-badge-sub  { font-size: 0.8rem; color: var(--gray-500); }
.sel-badge-clear {
    margin-right: auto; background: none; border: none;
    color: var(--gray-400); cursor: pointer; font-size: 1.1rem;
    line-height: 1; padding: 0 4px;
}
.sel-badge-clear:hover { color: var(--danger); }

/* ── Invoice type badges ── */
.finv-badge-tax {
    background: #d1fae5; color: #065f46;
    padding: 2px 8px; border-radius: 20px;
    font-size: 0.72rem; font-weight: 700;
}
.finv-badge-proforma {
    background: #ede9fe; color: #5b21b6;
    padding: 2px 8px; border-radius: 20px;
    font-size: 0.72rem; font-weight: 700;
}

/* ── Stamp (4 cm = 151px @ 96 dpi) ── */
.stamp-circle {
    width: 151px; height: 151px;
    border-radius: 50%;
    border: 2px dashed #d1d5db;
    margin: 0 auto 5px;
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
.stamp-circle img { width: 151px; height: 151px; object-fit: cover; border-radius: 50%; }

/* ════════════════════════════════════════
   login.css — redesigned light professional
   ════════════════════════════════════════ */
#loginPage {
    background: linear-gradient(145deg, #f0f7ff 0%, #fafdf7 50%, #fffdf0 100%);
    min-height: 100vh; display: none;
    align-items: center; justify-content: center; padding: 24px;
}
#loginPage.active { display: flex; }

/* ── 2-column wrap ── */
.login-wrap {
    width: 100%; max-width: 880px;
    display: flex;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(13,92,42,.14), 0 8px 24px rgba(0,0,0,.06);
    min-height: 540px;
}

/* ── Left brand panel ── */
.login-brand-panel {
    flex: 0 0 42%;
    background: linear-gradient(155deg, var(--primary) 0%, #0a4a22 65%, #062e16 100%);
    padding: 52px 36px 40px;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    position: relative; overflow: hidden;
    text-align: center;
}
/* decorative circles */
.lbp-deco { position: absolute; border-radius: 50%; pointer-events: none; }
.lbp-deco1 { width: 240px; height: 240px; background: rgba(255,255,255,.04); top: -80px; left: -80px; }
.lbp-deco2 { width: 160px; height: 160px; background: rgba(201,168,76,.07); bottom: -40px; right: -40px; }
.lbp-deco3 { width: 90px;  height: 90px;  background: rgba(255,255,255,.05); top: 55%; left: 18px; }

.login-logo-box {
    width: 88px; height: 88px; border-radius: 20px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 18px; font-size: 2.4rem;
    box-shadow: 0 8px 28px rgba(201,168,76,.35);
    overflow: hidden; flex-shrink: 0;
}
.login-logo-box img { width:100%; height:100%; object-fit:cover; border-radius:18px; }

.login-brand-panel h1 { color: white; font-size: 1.3rem; font-weight: 900; line-height: 1.4; margin-bottom: 6px; }
.login-brand-panel h2 { color: var(--accent); font-size: 0.88rem; font-weight: 500; margin-bottom: 8px; }
.lbp-tagline { color: rgba(255,255,255,.55); font-size: .8rem; margin-bottom: 28px; }

.lbp-stats { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.lbp-stat {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.1);
    border-radius: 10px; padding: 9px 14px;
    color: rgba(255,255,255,.85); font-size: .83rem; font-weight: 600;
}
.lbp-stat-icon { font-size: 1.1rem; }

/* ── Right form panel ── */
.login-form-panel {
    flex: 1; background: white;
    display: flex; align-items: center; justify-content: center;
    padding: 48px 44px;
}
.login-form-inner { width: 100%; max-width: 360px; }

.login-welcome-head {
    display: flex; align-items: center; gap: 14px;
    margin-bottom: 28px;
}
.login-welcome-emoji { font-size: 2rem; }
.login-welcome-title { font-size: 1.6rem; font-weight: 900; color: #111827; margin: 0 0 2px; }
.login-welcome-sub   { font-size: .85rem; color: #6b7280; margin: 0; }

.role-tabs {
    display: flex; background: #f3f4f6;
    border-radius: 50px; padding: 4px; margin-bottom: 24px; gap: 4px;
}
.role-tab {
    flex: 1; padding: 10px; border: none; border-radius: 40px;
    cursor: pointer; font-weight: 700; font-size: .88rem;
    background: transparent; color: #9ca3af;
    transition: var(--tr); font-family: 'Tajawal', sans-serif;
}
.role-tab.active-user  { background: linear-gradient(135deg, var(--primary), #1a7a3a); color: white; box-shadow: 0 4px 14px rgba(13,92,42,.3); }
.role-tab.active-admin { background: linear-gradient(135deg, #4c1d95, #7c3aed); color: white; box-shadow: 0 4px 14px rgba(124,58,237,.3); }

.login-form-panel .fg label { font-weight: 600; color: #374151; }
.login-form-panel .fg input {
    background: #f9fafb; border: 2px solid #e5e7eb;
    transition: border-color .2s, box-shadow .2s;
}
.login-form-panel .fg input:focus {
    border-color: var(--primary); background: white;
    box-shadow: 0 0 0 3px rgba(13,92,42,.08);
}

.btn-login {
    width: 100%; padding: 14px; margin-top: 4px;
    background: linear-gradient(135deg, var(--primary), #1a7a3a);
    color: white; border: none; border-radius: var(--radius);
    font-size: 1rem; font-weight: 800; cursor: pointer;
    transition: var(--tr); font-family: 'Tajawal', sans-serif;
    box-shadow: 0 4px 16px rgba(13,92,42,.25);
}
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(13,92,42,.35); }
.btn-login:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

.login-footer { text-align: center; margin-top: 22px; font-size: .75rem; color: #9ca3af; }

/* ── Monthly cards ── */
.month-card {
    border: 1.5px solid #e5e7eb;
    border-radius: 16px;
    margin-bottom: 12px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
    transition: box-shadow .2s, border-color .2s;
}
.month-card:hover { box-shadow: 0 4px 18px rgba(0,0,0,.08); }
.month-card.open  { border-color: var(--primary); box-shadow: 0 6px 24px rgba(13,92,42,.13); }

.month-card-hd {
    display: flex; justify-content: space-between; align-items: center;
    padding: 18px 22px; cursor: pointer; user-select: none;
    border-right: 4px solid transparent;
    transition: background .15s, border-color .15s;
}
.month-card:hover .month-card-hd { background: #f8fafc; }
.month-card.open  .month-card-hd { background: #f0fdf4; border-right-color: var(--primary); }

.month-hd-left  { display: flex; align-items: center; gap: 12px; }
.month-hd-right { display: flex; align-items: center; gap: 14px; }

.month-name { font-weight: 800; font-size: 1.05rem; color: #1a1a2e; }
.month-card.open .month-name { color: var(--primary); }

.month-badge {
    background: #f0fdf4; color: var(--primary);
    border: 1px solid #bbf7d0;
    padding: 3px 12px; border-radius: 20px;
    font-size: .73rem; font-weight: 700;
}
.month-card.open .month-badge { background: var(--primary); color: white; border-color: var(--primary); }

.month-rev { font-weight: 800; color: var(--primary); font-size: .97rem; }

.month-arrow {
    width: 30px; height: 30px; border-radius: 50%;
    background: #f1f5f9; border: 1px solid #e5e7eb;
    display: flex; align-items: center; justify-content: center;
    font-size: .95rem; color: #6b7280; font-weight: 700;
    transition: transform .25s, background .2s, color .2s;
    flex-shrink: 0;
}
.month-card.open .month-arrow { background: var(--primary); color: white; border-color: var(--primary); transform: rotate(90deg); }

/* card body — hidden until .open */
.month-card-body {
    display: none;
    padding: 0 22px 20px;
    background: white;
}
.month-card.open .month-card-body { display: block; }

/* divider between header and body */
.month-card.open .month-card-body { border-top: 1px solid #e8f5e9; }

.month-stats-grid {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 12px;
    padding: 18px 0 16px;
}
.ms-cell {
    text-align: center; padding: 14px 10px;
    border-radius: 12px; background: #f8fafc;
    border: 1.5px solid #f1f5f9;
    transition: border-color .15s;
}
.ms-cell.c-green  { background: #f0fdf4; border-color: #bbf7d0; }
.ms-cell.c-orange { background: #fff7ed; border-color: #fed7aa; }
.ms-cell.c-red    { background: #fef2f2; border-color: #fecaca; }
.ms-cell.c-purple { background: #f5f3ff; border-color: #ddd6fe; }

.ms-lbl {
    font-size: .67rem; color: #9ca3af; font-weight: 700;
    letter-spacing: .4px; text-transform: uppercase;
    margin-bottom: 7px;
}
.ms-val { font-size: 1rem; font-weight: 900; color: #111827; line-height: 1.2; }

.month-status-row { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
.ms-tag { font-size: .75rem; font-weight: 700; padding: 5px 13px; border-radius: 20px; white-space: nowrap; }
.ms-tag.done { background: #dcfce7; color: #166534; }
.ms-tag.prog { background: #fef3c7; color: #92400e; }
.ms-tag.newt { background: #ede9fe; color: #4c1d95; }
.ms-tag.paid { background: #d1fae5; color: #065f46; }
.ms-tag.unp  { background: #fee2e2; color: #991b1b; }
.ms-tag.part { background: #e0f2fe; color: #0c4a6e; }

/* section label inside monthly body */
.month-section-lbl {
    font-size: .7rem; font-weight: 700; color: #9ca3af;
    text-transform: uppercase; letter-spacing: .5px;
    margin-bottom: 8px;
}

/* ── Monthly Export Row ── */
.month-export-row {
    display: flex;
    gap: 10px;
    padding: 14px 0 4px;
    margin-top: 12px;
    border-top: 1px dashed #e2e8f0;
    flex-wrap: wrap;
}
.month-export-row .btn {
    flex: 1;
    min-width: 120px;
    font-size: 0.83rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 10px;
    padding: 9px 16px;
}
@media (max-width: 640px) {
    .month-export-row .btn { flex: 1 1 100%; }
}

/* ── Invoice header slim (when header image replaces company info) ── */
.inv-header-slim { justify-content: flex-end; border-bottom-color: transparent; padding-bottom: 8px; }

/* ── Invoice Header / Footer Banners ── */
.inv-banner { width: 100%; overflow: hidden; border-radius: 6px; }
.inv-banner-top { margin-bottom: 16px; }
.inv-banner-bot { margin-top: 16px; }
.inv-banner img { width: 100%; height: auto; display: block; }

/* ── Settings Brand Preview Card ── */
.settings-brand-preview {
    display: flex; align-items: center; gap: 18px;
    background: var(--gray-50); border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg); padding: 16px 20px;
    margin-bottom: 20px;
}
.sbp-logo {
    width: 72px; height: 72px; border-radius: 14px;
    background: white; border: 1px solid var(--gray-200);
    display: flex; align-items: center; justify-content: center;
    font-size: 2.4rem; flex-shrink: 0; overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.sbp-logo img { width: 100%; height: 100%; object-fit: contain; }
.sbp-name-en { font-size: 1rem; font-weight: 800; color: var(--gray-800); }
.sbp-name-ar { font-size: 0.82rem; color: var(--gray-500); margin-top: 4px; }

/* ════════════════════════════════════════
   responsive.css
   ════════════════════════════════════════ */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .quick-grid { grid-template-columns: repeat(2, 1fr); }
    .report-stats { grid-template-columns: repeat(3, 1fr); }
    .erc-grid { grid-template-columns: 1fr !important; }
    .erc-finance { grid-template-columns: repeat(2,1fr); }
    .erc-orders  { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 820px) {
    .login-wrap { flex-direction: column; max-width: 440px; min-height: unset; }
    .login-brand-panel { flex: none; padding: 32px 28px 28px; }
    .lbp-stats { display: none; }
    .login-form-panel { padding: 32px 28px; }
}

@media (max-width: 768px) {
    .main { padding: 10px 6px; }
    .topbar { padding: 0 10px; }
    .topbar-title small { display: none; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .col-full { grid-column: 1; }
    .inv-parties { grid-template-columns: 1fr; }
    .inv-bank-grid { grid-template-columns: 1fr; }
    .inv-sigs { flex-wrap: wrap; gap: 16px; justify-content: center; }
    .inv-title-area h1 { font-size: 1.6rem; }
    .tabs { flex-wrap: nowrap; overflow-x: auto; }
    .tab { min-width: 90px; }
    .section-head { flex-wrap: wrap; gap: 8px; }
    .search-bar { flex-direction: column; }
    .search-bar input, .search-bar select { min-width: unset; }
    .modal { max-width: 100%; margin: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 95vh; }
    .overlay { align-items: flex-end; padding: 0; }
    .rs .rv { font-size: 1.2rem; }
    .erc-head { padding: 16px; gap: 12px; }
    .erc-name { font-size: 1rem; flex-wrap: wrap; }
    .erc-orders  { grid-template-columns: repeat(2,1fr); }
    .erc-finance { grid-template-columns: repeat(2,1fr); }
    .erc-order-val { font-size: 1.2rem; }
    .erc-fin-val   { font-size: 0.82rem; }
    .erc-foot { flex-direction: column; gap: 10px; align-items: flex-start; }
}

@media (max-width: 480px) {
    .month-stats-grid { grid-template-columns: repeat(2,1fr); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .quick-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-value { font-size: 1.5rem; }
    .btn { padding: 8px 12px; font-size: 0.82rem; }
    .btn-lg { padding: 12px 20px; }
    .topbar-user-info .topbar-name { font-size: 0.8rem; }
    .erc-orders  { grid-template-columns: repeat(2,1fr); }
    .erc-finance { grid-template-columns: repeat(2,1fr); }
}

/* ── Login extra-small screens ── */
@media (max-width: 420px) {
    #loginPage { padding: 0; align-items: flex-end; }
    .login-wrap {
        border-radius: 24px 24px 0 0;
        max-width: 100%;
        box-shadow: 0 -8px 40px rgba(13,92,42,.18);
    }
    .login-brand-panel {
        padding: 28px 22px 22px;
        min-height: auto;
    }
    .login-logo-box { width: 72px; height: 72px; font-size: 1.8rem; margin-bottom: 14px; }
    .login-brand-panel h1 { font-size: 1.1rem; }
    .login-brand-panel h2 { font-size: 0.8rem; }
    .login-form-panel { padding: 22px 20px 32px; }
    .login-welcome-title { font-size: 1.35rem; }
}

/* ── Login RTL ── */
html[dir="rtl"] .login-brand-panel h1 { direction: rtl; }
html[dir="rtl"] .login-brand-panel h2 { direction: ltr; }
html[dir="rtl"] .lbp-stat { flex-direction: row-reverse; }
html[dir="rtl"] .login-form-panel .fg input { direction: ltr; text-align: left; }
html[dir="rtl"] .login-form-panel .fg label { text-align: right; }
html[dir="rtl"] .role-tabs { flex-direction: row-reverse; }
html[dir="rtl"] .login-footer { direction: ltr; }

@media print {
    body > *:not(#printTarget) { display: none !important; }
    #printTarget { display: block !important; }
    .inv-wrap, .vou-wrap { box-shadow: none; border: none; padding: 0; }
}