/* invoices sayfalari - yeni tasarim (cl-* / db-* / dp-* desenleri app.css icinde)
   Bu dosyadaki siniflar iv- onekiyle baslar. */

/* --------------------------------------------------------------------------
   Fatura listesi (/faturalar)
   -------------------------------------------------------------------------- */

.iv-table {
    --cl-cols: 52px minmax(150px, 1fr) minmax(200px, 2fr) 120px 120px 110px 170px;
}

/* Hucreler satirin dogrudan grid ogesi olsun diye baglanti kutu uretmez */
.iv-link { display: contents; color: inherit; text-decoration: none; }

.iv-row .cl-cell { cursor: pointer; }
.iv-row .iv-pick { cursor: default; display: flex; align-items: center; }
.iv-row .iv-pick .checkbox { margin: 0; }

.iv-no, .iv-account, .iv-due, .iv-edoc, .iv-amount {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.iv-no b, .iv-account b, .iv-amount b { font-weight: 600; }
.iv-account b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iv-no small, .iv-account small, .iv-due small, .iv-edoc small, .iv-amount small { font-size: 12px; color: var(--ink-3); }
.iv-account small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iv-due, .iv-edoc { color: var(--ink-2); white-space: nowrap; }
.iv-due small.is-late, .iv-due small.is-payable,
.iv-edoc small.is-late, .iv-edoc small.is-payable { font-weight: 500; }
.iv-edoc small.is-ok { color: var(--credit-ink); font-weight: 500; }
.iv-muted { color: var(--ink-3); }

.iv-status { display: flex; flex-wrap: wrap; gap: 4px; }
.iv-amount { align-items: flex-end; text-align: right; white-space: nowrap; }
.cl-row-head .iv-amount { display: block; }

.iv-mobile-meta, .iv-mobile-only { display: none !important; }

/* Durum etiketleri */
.cl-pill.iv-st-draft     { background: var(--surface-2); color: var(--ink-2); }
.cl-pill.iv-st-approved  { background: var(--credit-soft); color: var(--credit-ink); }
.cl-pill.iv-st-cancelled { background: var(--debt-soft); color: var(--debt-ink); }
.cl-pill.iv-st-new       { background: var(--brand-soft); color: var(--brand); }
.cl-pill.iv-pill-warn    { background: var(--warn-soft); color: var(--warn-ink); }

/* Durum ciplerindeki sayi */
/* Liste sayfalari .cl.iv kapsayicisinda; genel siniflar yalnizca burada genisletilir */
.iv a.cl-chip { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; box-sizing: border-box; }
.iv-chip > span { font-size: 11.5px; color: var(--ink-3); }
.iv-chip.is-active > span { color: var(--brand); }

.iv a.cl-filter { text-decoration: none; box-sizing: border-box; }

/* Toplu secim baglantilari */
.iv-selectbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 16px;
    padding: 0 16px 10px;
    font-size: 13px;
}

.iv-select-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    color: var(--brand);
    text-decoration: none;
}

.iv-select-link .icon { font-size: 15px; }
.iv-select-hint { margin-left: auto; color: var(--ink-3); font-size: 12.5px; }

/* Toplu indirme cubugu kartin icinde: kenarlara yapissin */
.iv .cl-card form > .bulkbar { margin: 0 14px 12px; }

@media (max-width: 899px) {
    .iv-table .iv-row {
        grid-template-columns: 44px minmax(0, 1fr) auto;
        grid-template-areas:
            "pick account amount"
            "pick status  amount";
        align-items: start;
    }

    .iv-row .iv-pick { grid-area: pick; align-self: center; }
    .iv-row .iv-account { grid-area: account; padding-bottom: 2px; }
    .iv-row .iv-status { grid-area: status; padding-top: 0; }
    .iv-row .iv-amount { grid-area: amount; align-self: center; }
    .iv-row .iv-no, .iv-row .iv-due, .iv-row .iv-edoc { display: none; }
    .iv-mobile-meta { display: inline !important; }
    .iv-mobile-only { display: inline-flex !important; }
    .iv-select-hint { display: none; }
}

/* --------------------------------------------------------------------------
   Gelen faturalari cek (/faturalar/gelen-cek)
   -------------------------------------------------------------------------- */

.iv-in-table {
    --cl-cols: 52px minmax(220px, 2fr) minmax(140px, 1fr) 110px 150px 150px;
}

.iv-in-row .iv-pick { display: flex; align-items: center; }
.iv-in-row .iv-pick .checkbox { margin: 0; }
.iv-in-row.is-passive { opacity: .75; }
.iv-in-no, .iv-in-date { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iv-in-state { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }

.iv-open-link { font-size: 12.5px; font-weight: 600; color: var(--brand); text-decoration: none; }

.iv-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: grid;
    place-items: center;
    background: var(--credit-soft);
    color: var(--credit-ink);
}

.iv-icon .icon { font-size: 15px; }

.iv-tools-title { font-size: 13.5px; color: var(--ink-2); }
.iv-tools-title b { color: var(--ink); font-weight: 600; }

.iv .cl-banner b { font-weight: 600; }
.iv .cl-banner.iv-banner-error { background: var(--debt-soft); color: var(--debt-ink); }
.iv .cl-banner.iv-banner-error .icon { color: var(--debt); }

/* Ozet hucreleri link degil */
.iv div.cl-sum { box-sizing: border-box; }

@media (max-width: 899px) {
    .iv-in-table .iv-in-row {
        grid-template-columns: 44px minmax(0, 1fr) auto;
        grid-template-areas:
            "pick account amount"
            "pick state   amount";
        align-items: start;
    }

    .iv-in-row .iv-pick { grid-area: pick; align-self: center; }
    .iv-in-row .iv-account { grid-area: account; padding-bottom: 2px; }
    .iv-in-row .iv-in-state { grid-area: state; padding-top: 0; }
    .iv-in-row .iv-amount { grid-area: amount; align-self: center; }
    .iv-in-row .iv-in-no, .iv-in-row .iv-in-date { display: none; }
}

/* --------------------------------------------------------------------------
   Fatura detayi ve e-belge onizlemesi (.dp deseni)
   -------------------------------------------------------------------------- */

.iv-hero-text { min-width: 0; }

.dp-avatar.iv-avatar-purchase { background: var(--warn-soft); color: var(--warn-ink); }

.iv-title-link { color: inherit; text-decoration: none; }
.iv-title-link:hover { color: var(--brand); }

.iv-detail .dp-meta .is-late .icon, .iv-detail .dp-meta .is-payable .icon { color: inherit; }

.iv-strike { text-decoration: line-through; color: var(--ink-3); }

/* Form icindeki db-btn (button): F7 tam genislik vermesin */
.iv-btn {
    width: auto;
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
}

.dp-actions .iv-btn { height: 38px; }

/* Navbar'daki uc nokta menu: dp-actions icinde de var, dar ekranda navbar'dan erisilir */
@media (min-width: 900px) {
    .navbar .iv-nav-more { display: none !important; }
}

.iv-head-note { font-size: 12.5px; color: var(--ink-3); }

/* Kalem tablosu */
.iv-lines { min-width: 0; }
.iv-lines td b { display: block; line-height: 1.35; }
.iv-lines td:last-child b { display: inline; }
.iv-lines .iv-discount { font-style: normal; color: var(--debt); }
.iv-lines .iv-line-meta { display: none; }

.iv-totals {
    margin-top: 4px;
    padding: 6px 20px 8px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: flex-end;
}

.iv-totals .dp-facts { width: 100%; max-width: 360px; margin-top: 0; }
.iv-grand { font-size: 17px; font-weight: 700 !important; }

.iv-small { font-size: 12px; }
.iv-ok { color: var(--credit-ink) !important; }
.iv-wrap { white-space: normal; }
.iv-note { line-height: 1.5; }
.iv-note a { color: var(--brand); text-decoration: none; font-weight: 500; }

.db-pill.iv-pill-danger { background: var(--debt-soft); color: var(--debt-ink) !important; }

/* E-belge onizlemesi: onay kutusu + gonder dugmesi */
.iv-warn { margin-top: 0; font-size: 12.5px; }

.iv-send-form { margin-top: 10px; }
.iv-send-form .iv-send-check { margin: 0 -20px 10px; }
.iv-send-form .iv-send-check ul { background: transparent; }
.iv-send-form .iv-send-check ul::before,
.iv-send-form .iv-send-check ul::after { display: none; }
.iv-send-form .iv-btn { height: 40px; }

@media (max-width: 640px) {
    .iv-lines .iv-col-wide { display: none; }
    .iv-lines .iv-line-meta { display: block; }
    .iv-totals { padding-left: 16px; padding-right: 16px; }
    .iv-totals .dp-facts { max-width: none; }
    .db-card.is-flush .iv-lines td:first-child,
    .db-card.is-flush .iv-lines th:first-child { padding-left: 16px; }
}
