/* ============================================================================
   כרטיס החשבונית שבראש טופס ההוספה: שורת הקובץ, התצוגה שלו, ורצועות
   "מולאו" ו"בוטל".

   **קובץ נפרד** מ-expense-invoice-zone.css לפי כלל 300 השורות. כרטיס
   הקריאה ב-expense-invoice-reading.css, ואזהרת הכפילות ב-expense-dup.css.
   ============================================================================ */

/* ── כרטיס הקובץ ── */
.exp-inv-box.exp-inv-has-file {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    transition: border-color .3s;
    animation: expInvSlideIn .3s ease-out both;
}

.exp-inv-box.exp-inv-has-file:has(.exp-inv-done) {
    border-color: #bbf7d0;
}

/* בזמן הקריאה הכרטיס הוא כרטיס הקריאה, ושורת הקובץ מוסתרת מתחתיו. */
.exp-inv-box.exp-inv-has-file:has(.exp-inv-reading) {
    border: none;
    background: none;
    overflow: visible;
}

.exp-inv-box:has(.exp-inv-reading) > :first-child {
    display: none;
}

.exp-inv-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
}

.exp-inv-file + .exp-inv-file {
    border-top: 1px solid #eef1f6;
}

.exp-inv-file-doc {
    position: relative;
    width: 40px;
    height: 50px;
    border-radius: 5px;
    border: 1px solid #d6e0ee;
    background: #fff;
    padding: 7px 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
}

.exp-inv-file-doc i {
    display: block;
    height: 2.5px;
    border-radius: 2px;
    background: #e2e8f0;
}

.exp-inv-file-doc i:nth-child(1) { width: 60%; background: #cbd5e1; }
.exp-inv-file-doc i:nth-child(2) { width: 100%; }
.exp-inv-file-doc i:nth-child(3) { width: 80%; }
.exp-inv-file-doc i:nth-child(4) { width: 90%; }

.exp-inv-file-doc b {
    position: absolute;
    bottom: -5px;
    inset-inline-start: -5px;
    font-size: 8.5px;
    font-weight: 700;
    color: #fff;
    background: #2f4f7f;
    border-radius: 3px;
    padding: 1px 4px;
}

.exp-inv-file-main {
    flex: 1;
    min-width: 0;
}

.exp-inv-file-name {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.exp-inv-file-sub {
    font-size: 11.5px;
    color: #64748b;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.exp-inv-file-btn {
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    padding: 7px 11px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.exp-inv-file-btn:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.exp-inv-file-remove {
    width: 32px;
    height: 32px;
    border-radius: 7px;
    border: 1px solid #e2e8f0;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}

.exp-inv-file-remove:hover {
    color: #dc2626;
    background: #fef2f2;
    border-color: #fecaca;
}

.exp-inv-preview {
    padding: 0 12px 12px;
}

.exp-inv-preview-frame {
    display: block;
    width: 100%;
    height: 320px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
}

/* ── רצועות מתחת לשורת הקובץ ── */
.exp-inv-done,
.exp-inv-undone {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 9px 12px;
    font-size: 12px;
}

.exp-inv-done {
    background: #f0fdf4;
    border-top: 1px solid #d1fae5;
}

.exp-inv-undone {
    background: #f8fafc;
    border-top: 1px solid #eef1f6;
    color: #5a6779;
}

.exp-inv-undone > span {
    flex: 1;
}

.exp-inv-done-title {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    color: #047857;
    white-space: nowrap;
}

.exp-inv-done-chips {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.exp-inv-done-chip {
    font-size: 11px;
    font-weight: 600;
    color: #065f46;
    background: #fff;
    border: 1px solid #bbf7d0;
    border-radius: 999px;
    padding: 1px 8px;
    white-space: nowrap;
    animation: expAiChipPop .3s ease-out both;
}

/* שורת "לא נקראה" בתוך הכרטיס: ריווח מבפנים ולא מעל. */
.exp-inv-box .exp-fill-alert--standalone {
    margin: 0 12px 12px;
}

.exp-inv-alerts {
    padding: 0 12px 12px;
}

.exp-inv-alerts > :first-child {
    margin-top: 10px;
}

@media (prefers-reduced-motion: reduce) {
    .exp-inv-box.exp-inv-has-file,
    .exp-inv-done-chip {
        animation: none;
    }
}

/* **בטלפון השם מקבל שורה משלו**, והכפתורים יורדים לשורה שמתחתיו. בשורה אחת
   נשארו לשם 33 פיקסלים ברוחב 320, ולא היה אפשר לדעת איזה קובץ צורף. */
@media (max-width: 520px) {
    .exp-inv-file {
        flex-wrap: wrap;
        row-gap: 8px;
    }

    .exp-inv-file-main {
        flex: 1 1 calc(100% - 52px);
    }

    .exp-inv-file-btn {
        margin-inline-start: 52px;
        min-height: 44px;
    }

    .exp-inv-file-remove {
        margin-inline-start: auto;
        width: 44px;
        height: 44px;
    }

    .exp-inv-done-chips {
        order: 1;
        flex-basis: 100%;
    }
}
