/* =========================================================
   Mülktakibi İyzico Panel — tasarım sistemi
   ========================================================= */
:root {
    --brand: #11B682;
    --brand-600: #0e9c6f;
    --brand-50: #e9f8f2;

    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #f9fafb;
    --border: #e6e8ec;
    --border-strong: #d5d9e0;

    --text: #111827;
    --text-2: #4b5563;
    --muted: #8a93a3;

    --ok: #0f9f6e;      --ok-bg: #e7f7f0;
    --warn: #b7791f;    --warn-bg: #fdf5e6;
    --bad: #d64545;     --bad-bg: #fdecec;
    --info: #2f6fde;    --info-bg: #ebf2fe;
    --neutral: #6b7280; --neutral-bg: #f1f2f4;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
    --sidebar-w: 240px;

    --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --bs-primary: var(--brand);
    --bs-primary-rgb: 17, 182, 130;
    --bs-link-color: var(--brand-600);
    --bs-link-hover-color: var(--brand);
}

html, body { background: var(--bg); }
body {
    font-family: var(--bs-body-font-family);
    color: var(--text);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: .92em; }
.num  { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted) !important; }

/* ---------- Bootstrap düzeltmeleri ---------- */
.btn { font-weight: 500; border-radius: var(--radius-sm); font-size: 13px; padding: .45rem .85rem; display: inline-flex; align-items: center; gap: .4rem; }
.btn-sm { font-size: 12.5px; padding: .3rem .6rem; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600); --bs-btn-active-bg: var(--brand-600); --bs-btn-active-border-color: var(--brand-600); --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); }
.btn-light { --bs-btn-bg: var(--surface); --bs-btn-border-color: var(--border-strong); --bs-btn-hover-bg: var(--surface-2); --bs-btn-hover-border-color: var(--border-strong); --bs-btn-color: var(--text); }
.btn-ghost { background: transparent; border: 1px solid transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--neutral-bg); color: var(--text); }
.btn-soft-danger { background: var(--bad-bg); color: var(--bad); border: 1px solid transparent; }
.btn-soft-danger:hover { background: var(--bad); color: #fff; }
.btn-soft-success { background: var(--ok-bg); color: var(--ok); border: 1px solid transparent; }
.btn-soft-success:hover { background: var(--ok); color: #fff; }
.btn-soft-warn { background: var(--warn-bg); color: var(--warn); border: 1px solid transparent; }
.btn-soft-warn:hover { background: var(--warn); color: #fff; }
.form-control, .form-select { border-color: var(--border-strong); border-radius: var(--radius-sm); font-size: 14px; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(17, 182, 130, .15); }
.form-label { font-weight: 500; font-size: 13px; color: var(--text-2); margin-bottom: .35rem; }
.form-text { color: var(--muted); font-size: 12px; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.modal-content { border: 0; border-radius: var(--radius); box-shadow: 0 20px 50px rgba(16, 24, 40, .18); }
.modal-header, .modal-footer { border-color: var(--border); }
.modal-title { font-weight: 600; font-size: 16px; }

/* ---------- Uygulama iskeleti ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1040;
    background: #0f1720; color: #c7cdd6;
    display: flex; flex-direction: column; padding: 18px 14px;
    transition: transform .2s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 4px 8px 18px; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 17px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { color: #fff; font-size: 15px; }
.brand-text small { color: #7d8794; font-size: 12px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #5f6976; padding: 14px 10px 6px; }
.sidebar .nav-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
    color: #c7cdd6; text-decoration: none; font-weight: 500; font-size: 14px;
    background: none; border: 0; text-align: left;
}
.sidebar .nav-item i { font-size: 16px; opacity: .85; }
.sidebar .nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar .nav-item.active { background: rgba(17, 182, 130, .16); color: #4fe0b0; }
.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 8px; min-width: 0; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #253140; color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.user-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.user-meta strong { color: #fff; font-size: 13px; }
.user-meta small { color: #7d8794; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { flex: 1; margin-left: var(--sidebar-w); padding: 28px 32px 48px; min-width: 0; }
.mobile-bar { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    body.nav-open .sidebar { transform: none; }
    body.nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 1030; }
    .main { margin-left: 0; padding: 16px 16px 40px; }
    .mobile-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
}
.icon-btn { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); display: grid; place-items: center; font-size: 18px; }

/* ---------- Sayfa başlığı ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin: 4px 0 0; font-size: 13.5px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); text-decoration: none; margin-bottom: 6px; }
.back-link:hover { color: var(--text); }

/* ---------- Kart ---------- */
.card-x { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-x + .card-x { margin-top: 16px; }
.card-x-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-x-head h2 { font-size: 15px; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 8px; }
.card-x-head h2 i { color: var(--muted); }
.card-x-body { padding: 18px; }

/* ---------- KPI kutucukları ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); position: relative; }
.stat-label { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 20px; font-weight: 700; margin-top: 4px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.accent { background: linear-gradient(180deg, #f2fbf7, #fff); border-color: #c8ecdc; }
.stat.accent .stat-value { color: var(--ok); }
.stat .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ---------- Durum etiketleri ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; line-height: 1.4; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.no-dot::before { display: none; }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }
.pill-info { background: var(--info-bg); color: var(--info); }
.pill-neutral { background: var(--neutral-bg); color: var(--neutral); }

/* ---------- Araç çubuğu ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.search { position: relative; flex: 1; max-width: 360px; min-width: 200px; }
.search i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-left: 34px; height: 36px; background: var(--surface-2); }
.toolbar .spacer { flex: 1; }
.selection-bar { display: none; align-items: center; gap: 8px; padding: 8px 14px; background: var(--brand-50); border-bottom: 1px solid #cdeee0; font-size: 13px; }
.selection-bar.show { display: flex; flex-wrap: wrap; }

/* Filtre sekmeleri */
.seg { display: inline-flex; background: var(--neutral-bg); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg .count { font-size: 11px; background: var(--warn-bg); color: var(--warn); border-radius: 999px; padding: 0 7px; font-weight: 600; }

/* ---------- Veri tablosu ---------- */
.table-wrap { overflow-x: auto; }
.dt { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.dt th {
    position: sticky; top: 0; background: var(--surface-2); color: var(--muted);
    font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
    padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; text-align: left;
}
.dt th.sortable { cursor: pointer; user-select: none; }
.dt th.sortable:hover { color: var(--text); }
.dt th .sort-ic { font-size: 11px; margin-left: 4px; opacity: .5; }
.dt th.sorted { color: var(--text); }
.dt th.sorted .sort-ic { opacity: 1; color: var(--brand); }
.dt td { padding: 12px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.dt tbody tr:last-child td { border-bottom: 0; }
.dt tbody tr { transition: background .1s; }
.dt tbody tr:hover { background: #fafbfc; }
.dt tbody tr.clickable { cursor: pointer; }
.dt tbody tr.selected { background: var(--brand-50); }
.dt .text-end, .dt th.text-end { text-align: right; }
.dt .cell-main { font-weight: 600; color: var(--text); max-width: 260px; overflow: hidden; text-overflow: ellipsis; display: block; }
.dt .cell-sub { font-size: 12px; color: var(--muted); max-width: 260px; overflow: hidden; text-overflow: ellipsis; display: block; }
.dt .amount { font-weight: 600; font-variant-numeric: tabular-nums; }
.dt .row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.dt .id-col { color: var(--muted); font-variant-numeric: tabular-nums; }
.dt-empty { padding: 48px 16px; text-align: center; color: var(--muted); }
.dt-empty i { font-size: 28px; display: block; margin-bottom: 8px; }
.skeleton { height: 12px; border-radius: 6px; background: linear-gradient(90deg, #eef0f3 25%, #f6f7f9 50%, #eef0f3 75%); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--border); flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.pager { display: flex; gap: 4px; align-items: center; }
.pager button { min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid var(--border); background: var(--surface); border-radius: 7px; font-size: 13px; color: var(--text-2); }
.pager button:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.pager button.active { background: var(--text); border-color: var(--text); color: #fff; }
.pager button:disabled { opacity: .45; }
.pager .gap { padding: 0 4px; }

/* "Bize Kalan" vurgulu kolon */
.dt th.col-ours { background: #e3f6ee; color: var(--ok); border-left: 1px solid #c8ecdc; border-right: 1px solid #c8ecdc; }
.dt td.col-ours { background: #f3fbf7; border-left: 1px solid #dcf2e8; border-right: 1px solid #dcf2e8; }
.dt tbody tr:hover td.col-ours { background: #eaf8f1; }
.ours-amount { font-weight: 700; font-size: 14px; color: var(--ok); font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; gap: 6px; }
.ours-rate { font-size: 11px; font-weight: 600; background: var(--ok); color: #fff; border-radius: 999px; padding: 1px 7px; }

/* Ödeyen cari detay popover'ı */
.cari-toggle { border: 0; background: none; color: var(--muted); padding: 0 2px; font-size: 12px; }
.cari-toggle:hover { color: var(--text); }
.cari-detail { display: none; margin-top: 6px; font-size: 12px; color: var(--text-2); white-space: normal; max-width: 320px; line-height: 1.55; }
.cari-detail.open { display: block; }
.cari-detail i { color: var(--muted); width: 14px; }

/* ---------- Tanım listesi (detay sayfaları) ---------- */
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px 24px; }
.kv-item dt { font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 3px; }
.kv-item dd { margin: 0; font-weight: 500; word-break: break-word; }
.kv.cols-1 { grid-template-columns: 1fr; gap: 14px; }
.kv-row { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.kv-row:last-child { border-bottom: 0; }
.kv-row span:first-child { color: var(--muted); }
.kv-row span:last-child { font-weight: 500; text-align: right; word-break: break-word; }

/* İşlem detay — özet şeridi */
.hero { display: grid; grid-template-columns: 1.1fr 2fr; gap: 0; }
.hero-amount { padding: 22px; border-right: 1px solid var(--border); }
.hero-amount .label { color: var(--muted); font-size: 12.5px; }
.hero-amount .value { font-size: 32px; font-weight: 700; letter-spacing: -.02em; margin: 2px 0 8px; font-variant-numeric: tabular-nums; }
.hero-meta { padding: 22px; }
@media (max-width: 767.98px) { .hero { grid-template-columns: 1fr; } .hero-amount { border-right: 0; border-bottom: 1px solid var(--border); } }

/* Para akış çubuğu */
.flow-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--neutral-bg); margin: 6px 0 14px; gap: 2px; }
.flow-bar > span { display: block; height: 100%; }
.flow-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.flow-legend .item { display: flex; gap: 10px; align-items: flex-start; }
.flow-legend .sw { width: 10px; height: 10px; border-radius: 3px; margin-top: 5px; flex: none; }
.flow-legend .t { font-size: 12.5px; color: var(--muted); }
.flow-legend .v { font-weight: 600; font-size: 16px; font-variant-numeric: tabular-nums; }
.flow-legend .s { font-size: 12px; color: var(--muted); }
.c-sub { background: #f2a93b; } .c-merchant { background: var(--brand); } .c-iyzico { background: #e05d5d; }

/* Kart görseli */
.card-visual { border-radius: 12px; padding: 16px 18px; color: #fff; background: linear-gradient(135deg, #1f2937, #374151); font-family: 'JetBrains Mono', monospace; }
.card-visual .num { font-size: 16px; letter-spacing: .12em; margin: 14px 0 10px; }
.card-visual .row-b { display: flex; justify-content: space-between; font-size: 12px; opacity: .85; font-family: 'Inter', sans-serif; }

/* JSON görüntüleyici */
.json-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; max-height: 60vh; overflow: auto; font-size: 12px; margin: 0; font-family: 'JetBrains Mono', monospace; }
details.raw > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
details.raw > summary::-webkit-details-marker { display: none; }
details.raw[open] > summary .chev { transform: rotate(90deg); }
details.raw .chev { transition: transform .15s; color: var(--muted); }

/* Alt bilgi kutusu */
.callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 16px; align-items: flex-start; }
.callout i { font-size: 16px; margin-top: 1px; }
.callout-warn { background: var(--warn-bg); color: #7a5212; border: 1px solid #f3dfb8; }
.callout-info { background: var(--info-bg); color: #1f4fa3; border: 1px solid #cfdffb; }

/* Form bölümleri */
.form-section { padding: 20px 18px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 240px 1fr; gap: 24px; }
.form-section:last-child { border-bottom: 0; }
.form-section-title h3 { font-size: 14px; font-weight: 600; margin: 0 0 4px; }
.form-section-title p { font-size: 12.5px; color: var(--muted); margin: 0; }
@media (max-width: 767.98px) { .form-section { grid-template-columns: 1fr; gap: 12px; } }
.type-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.type-picker label { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 12px 14px; cursor: pointer; display: flex; gap: 10px; align-items: flex-start; transition: all .12s; }
.type-picker label:hover { border-color: var(--brand); }
.type-picker input { margin-top: 3px; accent-color: var(--brand); }
.type-picker label:has(input:checked) { border-color: var(--brand); background: var(--brand-50); box-shadow: 0 0 0 3px rgba(17, 182, 130, .12); }
.type-picker strong { display: block; font-size: 13.5px; }
.type-picker small { color: var(--muted); font-size: 12px; }

/* SweetAlert uyumu */
.swal2-popup { border-radius: 14px !important; font-family: 'Inter', sans-serif !important; }
.swal2-styled.swal2-confirm { background: var(--brand) !important; border-radius: 8px !important; }
.swal2-styled.swal2-cancel { border-radius: 8px !important; }
