/* Bulut surumune ozel kucuk eklemeler. Ana gorunum style.css (eski uygulama) ile aynidir. */

/* Gizleme her zaman kazanir (style.css'teki .is-hidden'dan sonra yuklenen kurallar icin) */
.is-hidden,
.login-screen.is-hidden,
.app-layout.is-hidden {
    display: none !important;
}

/* Rol bazli gorunurluk */
body.role-operations [data-finance],
body.role-accounting [data-ops],
body:not(.role-admin) [data-admin] {
    display: none !important;
}

/* Giris ekrani */
.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
}

.login-panel {
    width: min(520px, 100%);
}

.login-panel .brand-row img {
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.login-panel .notice {
    width: auto;
    margin: 16px 0 0;
}

.login-form {
    margin-top: 18px;
}

.login-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.sidebar-logout {
    margin-top: 10px;
}

.finance-metrics {
    margin-top: 14px;
}

.sub-label {
    margin-top: 8px;
    font-size: 12px;
}

.freight-rate {
    margin-top: 8px;
}

.expense-line .driver-paid {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 12px;
    color: inherit;
    font-weight: 500;
}

.expense-line .driver-paid input {
    width: auto;
    margin: 0;
}

.alloc-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 160px;
    align-items: center;
    gap: 12px;
}

.alloc-row input[type="checkbox"] {
    width: auto;
}

.alloc-row label {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 0;
    font-weight: 500;
}

.alloc-row small {
    display: block;
    opacity: .75;
}

.link-list {
    margin-top: 10px;
}

.history-line {
    text-decoration: line-through;
    opacity: .6;
}

.provisional-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 11px;
    background: var(--amber-soft);
    color: var(--amber);
    border: 1px solid #fed7aa;
}

.mini-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    align-items: end;
    margin-top: 12px;
}

.mini-form .full {
    grid-column: 1 / -1;
}

@media (max-width: 640px) {
    .alloc-row {
        grid-template-columns: 1fr;
    }
}

.section-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.detail-actions {
    margin-top: 16px;
}

/* Dar ekranda icerik ekran genisligini asmasin (dikey yerlesimde alt ogeler genisligi doldurur) */
@media (max-width: 1180px) {
    .app-layout {
        align-items: stretch;
    }

    .container {
        width: 100%;
    }
}

@media (max-width: 620px) {
    .receivable-kpis,
    .profit-loss-metrics,
    .mini-form {
        grid-template-columns: 1fr;
    }

    .section-actions {
        width: 100%;
    }
}

/* Izgara ogeleri tablo genisligiyle sisip ekrandan tasmasin; tablo kendi icinde kayar */
.dashboard-grid > *,
.workspace-grid > *,
.dashboard-metrics > *,
.receivable-kpis > * {
    min-width: 0;
}

.dark-kpi.driver-settlement {
    flex-wrap: wrap;
}

.dark-kpi.driver-settlement small {
    flex-basis: 100%;
    opacity: .75;
    font-size: 11px;
    margin-top: 4px;
}

/* ================================================================ CARI EKRANI */
body:not(.role-operations) [data-ops-only] { display: none !important; }

.primary-button:disabled { cursor: not-allowed; opacity: .45; box-shadow: none; }

.cari-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.cari-kpi {
    position: relative;
    padding: 16px 18px 15px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    overflow: hidden;
}
.cari-kpi::before {
    content: "";
    position: absolute; inset: 0 auto 0 0;
    width: 4px;
    background: var(--navy-800);
}
.cari-kpi.tone-red::before { background: var(--red); }
.cari-kpi.tone-amber::before { background: var(--amber); }
.cari-kpi.tone-blue::before { background: var(--blue); }
.cari-kpi small { display: block; color: var(--slate-500); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.cari-kpi strong { display: block; margin: 6px 0 2px; font-size: 24px; font-variant-numeric: tabular-nums; }
.cari-kpi.tone-red strong.has-value { color: var(--red); }
.cari-kpi span { color: var(--slate-500); font-size: 12px; }

/* Yapilacaklar */
.cari-todo { margin-bottom: 18px; border-color: #bfdbfe; background: linear-gradient(180deg, #f5f9ff, #ffffff 60%); }
.cari-todo.is-done { border-color: var(--border); background: var(--white); }
.cari-todo.is-done .section-title p { display: none; }
.todo-list { display: grid; gap: 10px; }
.todo-empty { padding: 14px 16px; border-radius: 12px; background: var(--green-soft); color: #166534; font-weight: 700; font-size: 14px; }
.todo-row {
    display: grid;
    grid-template-columns: minmax(170px, 1.4fr) minmax(110px, .8fr) minmax(150px, 1fr) 150px 170px auto;
    gap: 12px;
    align-items: end;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--white);
}
.todo-info strong, .todo-amount strong { display: block; font-size: 14px; }
.todo-info span, .todo-amount span { display: block; color: var(--slate-500); font-size: 12px; margin-top: 3px; }
.todo-amount strong { font-variant-numeric: tabular-nums; }
.todo-info, .todo-amount { align-self: center; min-width: 0; }
.todo-field { margin: 0; min-width: 0; }
.todo-field small { display: block; margin-bottom: 4px; color: var(--slate-500); font-weight: 700; font-size: 11px; }
.todo-field input, .todo-field select { width: 100%; margin: 0; }
.todo-actions { display: flex; gap: 6px; align-items: center; }

/* Firma kartlari */
.cari-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.cari-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
    border: 1px solid var(--border);
    border-top: 4px solid var(--slate-300);
    border-radius: 14px;
    background: var(--white);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    transition: box-shadow .15s ease, transform .15s ease;
}
.cari-card:hover { box-shadow: 0 10px 26px rgba(15, 23, 42, .10); transform: translateY(-1px); }
.cari-card.tone-red { border-top-color: var(--red); }
.cari-card.tone-open { border-top-color: var(--blue); }
.cari-card.tone-closed { border-top-color: var(--green); }
.cari-card-head { display: flex; gap: 12px; align-items: center; min-width: 0; }
.cari-card-head > div { min-width: 0; }
.cari-card-head strong { display: block; font-size: 15px; line-height: 1.25; overflow-wrap: anywhere; }
.cari-card-head > div span { display: block; margin-top: 3px; color: var(--slate-500); font-size: 12px; }
.cari-avatar {
    flex: 0 0 auto;
    display: grid; place-items: center;
    width: 42px; height: 42px;
    border-radius: 12px;
    color: var(--white);
    background: linear-gradient(135deg, var(--navy-800), var(--blue-dark));
    font-weight: 800; font-size: 14px; letter-spacing: .03em;
}
.cari-card.tone-red .cari-avatar { background: linear-gradient(135deg, #7f1d1d, var(--red)); }
.cari-card.tone-closed .cari-avatar { background: linear-gradient(135deg, #14532d, var(--green)); }
.cari-card-amount small { display: block; color: var(--slate-500); font-size: 12px; font-weight: 700; }
.cari-card-amount strong { display: block; font-size: 26px; margin: 2px 0; font-variant-numeric: tabular-nums; }
.cari-card.tone-red .cari-card-amount strong { color: var(--red); }
.cari-card-amount span { color: var(--slate-500); font-size: 12px; }
.cari-progress { height: 6px; border-radius: 999px; background: var(--slate-100); overflow: hidden; }
.cari-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #22c55e, var(--green)); }
.cari-progress.small { height: 4px; margin-top: 6px; width: 100%; }
.cari-progress-text { margin-top: -6px; color: var(--slate-500); font-size: 11px; }
.cari-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    display: inline-flex; align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--slate-100);
    color: var(--slate-600);
    font-size: 11px; font-weight: 750;
    white-space: nowrap;
}
.chip-red { color: #b91c1c; background: var(--red-soft); border-color: #fecaca; }
.chip-blue { color: #1d4ed8; background: #eff6ff; border-color: #bfdbfe; }
.chip-green { color: #15803d; background: var(--green-soft); border-color: #bbf7d0; }
.cari-card-actions { display: flex; gap: 8px; margin-top: auto; }
.cari-card-actions button { flex: 1; }

/* Firma ekstresi */
.company-detail-panel { margin-top: 18px; border-color: #bfdbfe; box-shadow: 0 12px 30px rgba(37, 99, 235, .08); }
.cari-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    margin-bottom: 6px;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--border);
}
.cari-summary > div { padding: 12px 14px; background: #f8fafc; }
.cari-summary small { display: block; color: var(--slate-500); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.cari-summary strong { display: block; margin-top: 4px; font-size: 18px; font-variant-numeric: tabular-nums; }
.company-detail-panel .form-group-title { display: flex; align-items: center; gap: 8px; margin: 18px 0 10px; }
.count-pill { padding: 1px 8px; border-radius: 999px; background: var(--slate-100); color: var(--slate-600); font-size: 11px; }
.stmt-list { display: grid; gap: 8px; }
.stmt-row {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(130px, .8fr) 110px minmax(150px, auto);
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #fbfdff;
}
.stmt-main { min-width: 0; }
.stmt-main strong { font-size: 14px; }
.stmt-main > span:not(.provisional-badge) { display: block; margin-top: 3px; color: var(--slate-500); font-size: 12px; overflow-wrap: anywhere; }
.stmt-money { text-align: right; }
.stmt-money strong { display: block; font-variant-numeric: tabular-nums; }
.stmt-money span { display: block; color: var(--slate-500); font-size: 11px; }
.stmt-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.stmt-row.history-line { text-decoration: none; opacity: .55; }
.stmt-row.history-line .stmt-main strong { text-decoration: line-through; }
.alloc-chip { display: inline-block !important; margin: 4px 6px 0 0 !important; padding: 2px 8px; border-radius: 8px; background: var(--slate-100); color: var(--slate-600) !important; }
.link-button { padding: 0; border: 0; background: none; color: var(--blue); font-size: 11px; font-weight: 700; text-decoration: underline; }
.stmt-details { margin-top: 14px; }
.stmt-details summary { cursor: pointer; color: var(--slate-600); font-weight: 700; font-size: 13px; margin-bottom: 8px; }

/* Pencereler */
.modal-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(8, 17, 31, .55); backdrop-filter: blur(2px); }
.modal {
    position: fixed; inset: 0; z-index: 100;
    display: flex; align-items: flex-start; justify-content: center;
    padding: 5vh 16px;
    overflow-y: auto;
    pointer-events: none;
}
.modal-card { width: min(760px, 100%); pointer-events: auto; box-shadow: var(--shadow); animation: modal-in .16s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
body.modal-open { overflow: hidden; }

@media (max-width: 1180px) {
    .todo-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .todo-actions { grid-column: 1 / -1; }
    .todo-actions .primary-button { flex: 1; }
}
@media (max-width: 900px) {
    .cari-kpis, .cari-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stmt-row { grid-template-columns: minmax(0, 1fr) auto; }
    .stmt-status { order: -1; grid-column: 2; grid-row: 1; text-align: right; }
    .stmt-money { grid-column: 1; text-align: left; }
    .stmt-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 560px) {
    .cari-kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
    .cari-kpi strong { font-size: 19px; }
    .todo-row { grid-template-columns: 1fr; }
    .cari-cards { grid-template-columns: 1fr; }
    .modal { padding: 0; }
    .modal-card { min-height: 100%; border-radius: 0; }
}
.cari-kpis > *, .cari-cards > *, .todo-row > *, .stmt-row > * { min-width: 0; }

/* ================================================================ EXCEL AKTAR */
.imp-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 18px; padding: 0; list-style: none; }
.imp-steps li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: #f8fafc; color: var(--slate-600); font-weight: 700; font-size: 13px; }
.imp-steps strong { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--navy-800); color: var(--white); font-size: 12px; flex: 0 0 auto; }
.imp-panel { margin-bottom: 16px; }
.imp-drop {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 28px 16px; text-align: center;
    border: 2px dashed #bfdbfe; border-radius: 14px; background: #f5f9ff;
    transition: background .15s ease, border-color .15s ease;
}
.imp-drop.is-over { border-color: var(--blue); background: #e8f0ff; }
.imp-drop-icon { font-size: 30px; line-height: 1; color: var(--blue); }
.imp-drop > span, .imp-drop > small { color: var(--slate-500); font-size: 13px; }
.imp-summary { margin-top: 12px; }
.imp-warn { margin-top: 12px; padding: 12px 14px; border: 1px solid #fecaca; border-radius: 12px; background: var(--red-soft); color: #7f1d1d; font-size: 13px; }
.imp-warn ul { margin: 8px 0 0; padding-left: 18px; max-height: 220px; overflow: auto; }
.imp-warn p { margin: 6px 0 0; }
.imp-layouts { display: grid; gap: 14px; }
.imp-layout { border: 1px solid var(--border); border-left: 4px solid var(--blue); border-radius: 12px; padding: 14px; background: var(--white); }
.imp-layout.is-skip { border-left-color: var(--slate-300); background: #fafafa; }
.imp-layout.has-missing { border-left-color: var(--amber); }
.imp-layout-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.imp-layout-head > div { min-width: 0; }
.imp-layout-head strong { font-size: 15px; }
.imp-layout-head span { display: block; color: var(--slate-600); font-size: 12px; margin-top: 2px; }
.imp-layout-head small { display: block; color: var(--slate-500); font-size: 11px; margin-top: 2px; overflow-wrap: anywhere; }
.imp-kind { margin: 0; min-width: 200px; }
.imp-kind small, .imp-settings small { display: block; margin-bottom: 4px; color: var(--slate-500); font-weight: 700; font-size: 11px; }
.imp-kind select, .imp-settings input, .imp-settings select { width: 100%; margin: 0; }
.imp-missing { margin-top: 10px; padding: 8px 12px; border-radius: 10px; background: var(--amber-soft); color: #9a3412; font-size: 13px; }
.imp-settings { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.imp-settings label { margin: 0; min-width: 0; }
.imp-map { margin-top: 12px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.imp-map-head, .imp-map-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1fr); gap: 10px; align-items: center; padding: 7px 10px; }
.imp-map-head { background: var(--slate-100); color: var(--slate-600); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.imp-map-row { border-top: 1px solid var(--border); font-size: 13px; }
.imp-map-row.is-mapped { background: #f6fbf7; }
.imp-map-row > strong, .imp-map-row > span { min-width: 0; overflow-wrap: anywhere; }
.imp-map-row > span { color: var(--slate-500); font-size: 12px; }
.imp-map-row select { width: 100%; margin: 0; padding-top: 6px; padding-bottom: 6px; }
.imp-unrecognized details { margin-top: 12px; font-size: 13px; color: var(--slate-600); }
.imp-unrecognized summary { cursor: pointer; font-weight: 700; }
.imp-unrecognized ul { max-height: 200px; overflow: auto; }
.imp-muted { color: var(--slate-500); font-size: 12px; margin: 8px 0 0; }
.imp-actions { margin-top: 16px; justify-content: flex-end; }
.imp-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.imp-kpi { text-align: left; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: #f8fafc; cursor: pointer; font: inherit; color: inherit; }
.imp-kpi.is-static { cursor: default; }
.imp-kpi.active { border-color: var(--blue); background: #eff6ff; box-shadow: inset 0 0 0 1px var(--blue); }
.imp-kpi small { display: block; color: var(--slate-500); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.imp-kpi strong { display: block; font-size: 22px; margin: 3px 0 1px; font-variant-numeric: tabular-nums; }
.imp-kpi span { color: var(--slate-500); font-size: 12px; }
.imp-kpi.tone-red strong { color: var(--red); }
.imp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.imp-table th { text-align: left; padding: 8px 10px; background: var(--slate-100); color: var(--slate-600); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.imp-table td { padding: 8px 10px; border-top: 1px solid var(--border); vertical-align: top; }
.imp-src { color: var(--slate-500); font-size: 12px; overflow-wrap: anywhere; min-width: 160px; }
.imp-warn-text { display: block; margin-top: 3px; color: #9a3412; font-size: 11px; }
.imp-progress { margin-bottom: 14px; }
.imp-progress-track { height: 10px; border-radius: 999px; background: var(--slate-100); overflow: hidden; }
.imp-progress-track span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--blue), #22c55e); transition: width .2s ease; }
.imp-progress small { display: block; margin-top: 6px; color: var(--slate-600); font-size: 12px; }
.imp-result-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.imp-result-card { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: #f8fafc; }
.imp-result-card strong { flex-basis: 100%; }
@media (max-width: 900px) {
    .imp-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .imp-settings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .imp-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .imp-result-grid { grid-template-columns: 1fr; }
    .imp-map-head { display: none; }
    .imp-map-row { grid-template-columns: 1fr; gap: 4px; }
}
@media (max-width: 560px) {
    .imp-settings { grid-template-columns: 1fr; }
}
.imp-steps > *, .imp-kpis > *, .imp-settings > *, .imp-result-grid > * { min-width: 0; }

/* ================================================================ HIZLI TUR KONTROLLERI */
.tour-checks { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid #fed7aa; border-radius: 12px; background: var(--amber-soft); }
.check-row { color: #9a3412; font-size: 13px; font-weight: 600; }
.check-row.is-error { color: #b91c1c; }

/* ================================================================ UYARILAR */
.nav-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; vertical-align: middle; }
.alerts-panel { margin-bottom: 18px; border-color: #fde68a; background: linear-gradient(180deg, #fffbeb, #ffffff 70%); }
.alerts-list { display: grid; gap: 8px; }
.alert-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-left: 4px solid var(--blue); border-radius: 11px; background: var(--white); }
.alert-row.level-red { border-left-color: var(--red); }
.alert-row.level-amber { border-left-color: var(--amber); }
.alert-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #eff6ff; color: var(--blue); font-weight: 900; }
.level-red .alert-icon { background: var(--red-soft); color: var(--red); }
.level-amber .alert-icon { background: var(--amber-soft); color: var(--amber); }
.alert-text { min-width: 0; }
.alert-text strong { display: block; font-size: 14px; }
.alert-text span { display: block; margin-top: 2px; color: var(--slate-500); font-size: 12px; overflow-wrap: anywhere; }
@media (max-width: 620px) { .alert-row { grid-template-columns: 30px minmax(0, 1fr); } .alert-row button { grid-column: 1 / -1; } }

/* ================================================================ RAPORLAR */
.rep-filters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) auto; gap: 10px; align-items: end; margin-bottom: 16px; }
.rep-filters label { margin: 0; min-width: 0; }
.rep-filters small { display: block; margin-bottom: 4px; color: var(--slate-500); font-weight: 700; font-size: 11px; }
.rep-filters input, .rep-filters select { width: 100%; margin: 0; }
.rep-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.rep-kpis .cari-kpi strong { font-size: 20px; }
.cari-kpi.tone-green::before { background: var(--green); }
.rep-two { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; }
.rep-table td, .rep-table th { white-space: nowrap; }
.rep-total td { font-weight: 800; background: #f8fafc; }
.aging-dot { display: inline-block; width: 9px; height: 9px; margin-right: 8px; border-radius: 50%; background: var(--green); }
.aging-1 { background: #f59e0b; } .aging-2 { background: #f97316; } .aging-3 { background: #ef4444; } .aging-4 { background: #991b1b; }
.rep-print-header { display: none; }
.tours-list-panel + .tours-list-panel, .rep-two + .tours-list-panel, .tours-list-panel + .rep-two { margin-top: 16px; }
@media (max-width: 1180px) {
    .rep-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .rep-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .rep-two { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
    .rep-filters, .rep-kpis { grid-template-columns: 1fr 1fr; }
}
.rep-filters > *, .rep-kpis > *, .rep-two > * { min-width: 0; }

/* ================================================================ YAZDIR / PDF */
@media print {
    @page { size: A4 landscape; margin: 12mm; }
    body { background: #fff !important; }
    .sidebar, .header, .notice, .no-print, .nav-item, #modal_backdrop, .modal, .rep-filters, button { display: none !important; }
    .app-layout { display: block; width: auto; margin: 0; }
    .container { box-shadow: none; border-radius: 0; overflow: visible; }
    .app-view:not(.is-hidden) { padding: 0 !important; }
    .rep-print-header { display: block; margin: 0 0 10px; color: #334155; font-size: 12px; }
    .panel, .cari-kpi { break-inside: avoid; box-shadow: none !important; }
    .table-wrap { overflow: visible !important; }
    .rep-kpis { grid-template-columns: repeat(6, 1fr); }
    .rep-two { grid-template-columns: 1fr 1fr; }
    .data-table { font-size: 10px; }
    .link-button { display: inline !important; color: inherit; text-decoration: none; }
}
.rep-two .rep-table td, .rep-two .rep-table th { white-space: normal; padding-left: 8px; padding-right: 8px; }
@media (min-width: 1181px) and (max-width: 1500px) { .rep-two { grid-template-columns: 1fr; } }

/* ================================================================ CARILER / FATURALANDIRMA (sade) */
.cari-kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cari-kpi strong.has-value { color: var(--red); }
.cari-search { min-width: 220px; margin: 0; }
.cari-table td { vertical-align: middle; }
.cari-table tr.row-alert td:first-child { box-shadow: inset 4px 0 0 var(--red); }
.muted { color: var(--slate-500); font-weight: 500; }
.info-strip { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0; padding: 10px 14px; border-radius: 12px; background: #eff6ff; color: #1e3a8a; font-size: 13px; }
.cari-summary-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.statement-table td:nth-child(3), .statement-table td:nth-child(4), .statement-table td:nth-child(5),
.statement-table th:nth-child(3), .statement-table th:nth-child(4), .statement-table th:nth-child(5) { text-align: right; white-space: nowrap; }
.nav-badge-blue { background: var(--blue); }
.inv-tabs { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 14px; border: 1px solid var(--border); border-radius: 12px; background: #f1f5f9; }
.inv-tab { padding: 9px 16px; border: 0; border-radius: 9px; background: transparent; color: var(--slate-600); font-weight: 750; }
.inv-tab b { display: inline-grid; place-items: center; min-width: 22px; height: 20px; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: #e2e8f0; color: var(--slate-700); font-size: 11px; }
.inv-tab.active { background: var(--white); color: var(--navy-900); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.inv-tab.active b { background: var(--blue); color: #fff; }
.todo-row.inv-row { grid-template-columns: minmax(200px, 1.5fr) minmax(140px, 1fr) 150px 170px 160px auto; align-items: start; }
.inv-row .todo-info { align-self: start; }
.todo-amount-inline { display: block; margin-top: 4px; color: var(--navy-900) !important; font-weight: 800; font-size: 14px !important; }
.inv-row .todo-actions { align-self: end; flex-direction: column; align-items: stretch; }
.term-pick { display: flex; gap: 6px; }
.term-pick select { flex: 1; min-width: 0; margin: 0; }
.term-pick input { width: 74px; margin: 0; }
.due-hint, .inv-row .due-hint { display: block; margin-top: 4px; color: var(--blue-dark) !important; font-weight: 700; font-size: 11px; }
.inv-filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.inv-filters input { flex: 1; min-width: 200px; margin: 0; }
.inv-filters select { width: 200px; margin: 0; }
.alloc-preview { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #f8fafc; font-size: 13px; color: var(--slate-700); }
.alloc-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.alloc-manual-toggle { display: inline-flex; gap: 8px; align-items: center; margin: 10px 0 6px; font-size: 13px; font-weight: 600; color: var(--slate-600); }
.alloc-manual-toggle input { width: auto; margin: 0; }
@media (max-width: 1180px) {
    .todo-row.inv-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .inv-row .todo-info { grid-column: 1 / -1; }
    .inv-row .todo-actions { grid-column: 1 / -1; flex-direction: row; }
}
@media (max-width: 620px) {
    .cari-kpis-3, .cari-summary-3 { grid-template-columns: 1fr; }
    .todo-row.inv-row { grid-template-columns: 1fr; }
    .cari-search { min-width: 0; width: 100%; }
    .inv-tabs { display: flex; }
    .inv-tab { flex: 1; padding: 9px 8px; }
}
.cari-table .table-actions { display: flex; flex-direction: row; flex-wrap: nowrap; gap: 8px; justify-content: flex-end; }
#companies_view > .section-title .section-actions { flex-wrap: nowrap; }
@media (max-width: 900px) { .cari-table .table-actions { flex-wrap: wrap; } #companies_view > .section-title .section-actions { flex-wrap: wrap; } }
body.env-test .sidebar { box-shadow: inset 0 4px 0 #f59e0b; }
body.env-test #sidebar_org::after { content: ""; }

/* ---------- Yedek Al ---------- */
.backup-panel { margin-bottom: 18px; }
.backup-row { display: flex; gap: 18px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.backup-row > div { flex: 1 1 320px; }
.backup-row h2 { margin: 0 0 6px; }
.backup-row p { margin: 0 0 6px; }
.backup-last { color: var(--muted, #5b6b7f); }
.backup-warn { color: #a5560c; font-weight: 600; }
.backup-status { margin: 8px 0 0; font-size: 0.92em; color: var(--muted, #5b6b7f); min-height: 1.2em; }
#backup_button { min-width: 160px; }

/* ---------- Şifre değiştir ---------- */
.sidebar-password { display: block; margin-top: 10px; color: #c9d6ea; font-size: 12px; }
.modal-narrow { max-width: 460px; }

/* ---------- Sözleşmeler ---------- */
.legal-links { margin-top: 18px; text-align: center; font-size: 12px; color: var(--muted, #5b6b7f); }
.legal-links .link-button { font-size: 12px; }
.legal-gate-title { margin: 0 0 4px; }
.legal-block:empty { display: none; }
.legal-org-intro { margin: 6px 0 8px; font-weight: 600; }
.legal-item { border: 1px solid #d9e1ec; border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; background: #f8fafc; }
.legal-item-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.legal-item-head strong { flex: 1 1 auto; }
.legal-ver { font-size: 12px; color: var(--muted, #5b6b7f); }
.legal-check { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; font-size: 14px; line-height: 1.4; cursor: pointer; }
.legal-check input { width: 18px; height: 18px; margin-top: 2px; flex: 0 0 auto; }
.legal-check input:disabled + span { color: #8a97a8; }
.legal-hint { display: block; margin-top: 4px; }
.legal-signer { border-top: 1px dashed #c8d3e1; margin-top: 6px; padding-top: 10px; }
.legal-signer-title { font-weight: 700; margin: 0 0 6px; }
.legal-modal-card { max-width: 880px; width: calc(100vw - 32px); }
.legal-modal-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.legal-body { max-height: 68vh; overflow: auto; padding: 4px 6px 12px 2px; font-size: 14px; line-height: 1.55; color: #1c2738; }
.legal-body h1 { font-size: 20px; margin: 4px 0 10px; }
.legal-body h2 { font-size: 16px; margin: 18px 0 6px; }
.legal-body h3 { font-size: 15px; margin: 14px 0 6px; }
.legal-body p { margin: 0 0 10px; }
.legal-body ul { margin: 0 0 10px; padding-left: 22px; }
.legal-body hr { border: 0; border-top: 1px solid #d9e1ec; margin: 22px 0; }
.legal-table { overflow-x: auto; margin: 0 0 12px; }
.legal-table table { border-collapse: collapse; width: 100%; font-size: 13px; }
.legal-table th, .legal-table td { border: 1px solid #d9e1ec; padding: 6px 8px; text-align: left; vertical-align: top; }
.legal-table th { background: #eef3f9; }
.legal-fill { background: #fff3c4; padding: 0 2px; border-radius: 3px; }
.legal-error { color: #b42318; font-weight: 600; }
@media print {
    body.print-legal * { visibility: hidden !important; }
    body.print-legal #legal_modal, body.print-legal #legal_modal * { visibility: visible !important; }
    body.print-legal #legal_modal { position: absolute !important; inset: 0 auto auto 0 !important; width: 100% !important; display: block !important; background: #fff !important; }
    body.print-legal .legal-modal-card { box-shadow: none !important; border: 0 !important; max-width: none !important; width: 100% !important; }
    body.print-legal .legal-modal-actions { display: none !important; }
    body.print-legal .legal-body { max-height: none !important; overflow: visible !important; }
    body.print-legal .modal-backdrop { display: none !important; }
    body.print-legal .legal-fill { background: none; }
}

/* ---------- Tedarik ---------- */
.sup-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .sup-kpis { grid-template-columns: 1fr; } }
#sup_detail { margin-top: 18px; }
.subcontract-line { border: 1px dashed #c08a1a; border-radius: 10px; padding: 8px 10px; background: #fff8e6; }
.subcontract-line label { color: #8a5a00; font-weight: 700; }
tr.rep-sum td { background: #f3f6fa; border-top: 2px solid #d9e1ec; }
.sup-head-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: flex-start; }
