/* ==========================================================================
   Defterdar tasarım sistemi
   Yumuşak gölgeli kenarlıksız kartlar, mor ana renk, Public Sans.
   Renkler token olarak tanımlıdır. Koyu tema <html data-theme="dark"> ile açılır;
   seçim (açık / koyu / sistem) partials/head.php içindeki betikte uygulanır.
   ========================================================================== */

:root {
    --bg: #f5f5f9;
    --surface: #ffffff;
    --surface-2: #fafbfc;
    --surface-3: #f5f5f9;
    --border: #d9dee3;
    --border-soft: #eceef1;
    --heading: #566a7f;
    --text: #566a7f;
    --text-2: #697a8d;
    --text-3: #a1acb8;

    --primary: #696cff;
    --primary-hover: #5f61e6;
    --primary-soft: #e7e7ff;
    --primary-text: #696cff;

    --green: #56ca00;
    --green-solid: #71dd37;
    --green-bg: #e8fadf;
    --red: #ff3e1d;
    --red-solid: #ff3e1d;
    --red-bg: #ffe0db;
    --amber: #e69500;
    --amber-solid: #ffab00;
    --amber-bg: #fff2d6;
    --blue: #03b0d6;
    --blue-solid: #03c3ec;
    --blue-bg: #d7f5fc;
    --violet: #696cff;
    --violet-bg: #e7e7ff;
    --gray: #8592a3;
    --gray-bg: #ebeef0;

    --radius-sm: 4px;
    --radius: 6px;
    --radius-lg: 8px;
    --shadow-sm: 0 2px 6px 0 rgba(67, 89, 113, .12);
    --shadow: 0 .25rem 1rem rgba(161, 172, 184, .45);
    --shadow-lg: 0 2px 16px 0 rgba(67, 89, 113, .45);
    --shadow-primary: 0 .125rem .25rem 0 rgba(105, 108, 255, .4);
    --focus: 0 0 .25rem .05rem rgba(105, 108, 255, .1);

    --sidebar-w: 260px;
    --font: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    color-scheme: light;
}

:root[data-theme="dark"] {
        --bg: #232333;
        --surface: #2b2c40;
        --surface-2: #2f3047;
        --surface-3: #323249;
        --border: #444564;
        --border-soft: #3b3c56;
        --heading: #cbcbe2;
        --text: #cbcbe2;
        --text-2: #a3a4cc;
        --text-3: #7071a4;

        --primary-soft: #35365f;
        --primary-text: #8e90ff;

        --green-bg: #36483f;
        --red-bg: #4d2f3a;
        --amber-bg: #4d4036;
        --amber: #ffb829;
        --blue-bg: #25445c;
        --blue: #23c9ef;
        --violet-bg: #35365f;
        --gray-bg: #3b3c56;

        --shadow-sm: 0 2px 6px 0 rgba(20, 21, 33, .35);
        --shadow: 0 .25rem 1rem rgba(20, 21, 33, .55);
        --shadow-lg: 0 2px 16px 0 rgba(20, 21, 33, .6);

        color-scheme: dark;
}

/* Tema düğmesi: aktif temanın simgesi ve seçili seçenek */
.tema-ikon-koyu { display: none; }
[data-theme="dark"] .tema-ikon-acik { display: none; }
[data-theme="dark"] .tema-ikon-koyu { display: inline; }
[data-tema-secim="acik"] [data-tema="acik"],
[data-tema-secim="koyu"] [data-tema="koyu"],
[data-tema-secim="sistem"] [data-tema="sistem"] { background: var(--primary-soft); color: var(--primary); }
.dropdown-menu.dar { min-width: 160px; }

/* --- Temel --------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.53;
    color: var(--text-2);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 500; color: var(--heading); }
p { margin: 0; }
[hidden] { display: none !important; }
.icon { flex-shrink: 0; vertical-align: middle; }
kbd {
    font: 600 11px/1 var(--font);
    padding: 3px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, .2);
}
:focus-visible { outline: none; box-shadow: var(--focus), 0 0 0 2px var(--primary-soft); }

.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.strong { font-weight: 600; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 24px; }
.mt-6 { margin-top: 28px; }
.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

/* --- Yerleşim ------------------------------------------------------------ */

.app { display: flex; min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    padding: 0 0 16px;
    background: var(--surface);
    box-shadow: 0 .125rem .375rem 0 rgba(161, 172, 184, .12);
    z-index: 50;
    overflow-y: auto;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 64px;
    padding: 0 32px;
    margin: 6px 0 8px;
    font-size: 25px;
    font-weight: 700;
    color: var(--heading);
    letter-spacing: -.02em;
}
.brand:hover { color: var(--heading); }
.brand-mark {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    box-shadow: var(--shadow-primary);
}
.sidebar-cta { padding: 0 16px 8px; }
.sidebar-cta .btn { width: 100%; justify-content: space-between; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
    position: relative;
    margin: 18px 0 8px;
    padding: 0 32px;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: var(--text-3);
}
.nav-label::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 14px;
    height: 1px;
    background: var(--border);
}
.nav a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 16px;
    padding: 9px 16px;
    border-radius: var(--radius);
    color: var(--text-2);
    font-size: 15px;
}
.nav a:hover { background: var(--surface-3); color: var(--text-2); }
.nav a.active { background: var(--primary-soft); color: var(--primary-text); font-weight: 500; }
.nav a.active::after {
    content: "";
    position: absolute;
    right: -16px;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 4px 0 0 4px;
    background: var(--primary);
}
.nav-badge {
    margin-left: auto;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: var(--red);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
}

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }

/* Yüzen üst bar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    padding: 16px 26px 0;
    background: linear-gradient(to bottom, var(--bg) 60%, transparent);
}
.topbar-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 62px;
    padding: 0 20px;
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.topbar-search { flex: 1; display: flex; align-items: center; gap: 10px; color: var(--heading); }
.topbar-search input {
    flex: 1;
    min-width: 0;
    height: 40px;
    border: 0;
    background: transparent;
    color: var(--text);
    font: 15px var(--font);
    outline: none;
}
.topbar-search input::placeholder { color: var(--text-3); }
.topbar-search input:focus { box-shadow: none; }
.menu-btn { display: none; }
.content { width: 100%; max-width: 1440px; padding: 24px 26px 56px; }
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(67, 89, 113, .5);
    z-index: 45;
    display: none;
}

/* Kullanıcı menüsü */
.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    min-width: 240px;
    padding: 8px 0;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    z-index: 60;
}
.dropdown-head { display: flex; align-items: center; gap: 12px; padding: 8px 16px 12px; }
.dropdown-head strong { display: block; color: var(--heading); font-weight: 600; line-height: 1.3; }
.dropdown-head small { color: var(--text-3); }
.dropdown-divider { height: 1px; margin: 4px 0; background: var(--border-soft); }
.dropdown-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    border: 0;
    background: transparent;
    color: var(--text-2);
    font: 15px var(--font);
    text-align: left;
    cursor: pointer;
}
.dropdown-item:hover { background: var(--surface-3); color: var(--text-2); }
.avatar-online { position: relative; display: inline-flex; }
.avatar-online::after {
    content: "";
    position: absolute;
    right: 1px;
    bottom: 1px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--green-solid);
    box-shadow: 0 0 0 2px var(--surface);
}

@media (max-width: 1199px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
    body.sidebar-acik .sidebar { transform: none; }
    body.sidebar-acik .overlay { display: block; }
    .main { margin-left: 0; }
    .menu-btn { display: inline-grid; }
}
@media (max-width: 720px) {
    .topbar { padding: 12px 12px 0; }
    .topbar-inner { padding: 0 12px; }
    .content { padding: 16px 12px 96px; }
    .hide-mobile { display: none !important; }
}

/* --- Sayfa başlığı --------------------------------------------------------- */

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.page-title { font-size: 22px; font-weight: 500; color: var(--heading); }
.page-sub { margin-top: 2px; color: var(--text-3); }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.breadcrumb { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; font-size: 14px; color: var(--text-3); }
.breadcrumb a { color: var(--text-3); }
.breadcrumb a:hover { color: var(--primary); }

/* --- Izgara ------------------------------------------------------------- */

.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-hero { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 1399px) {
    .grid-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-hero > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 1199px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-main { grid-template-columns: minmax(0, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
    .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
    .grid-4 { grid-template-columns: minmax(0, 1fr); }
}

/* --- Kart --------------------------------------------------------------- */

.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    min-width: 0;
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 24px 24px 12px;
}
.card-head.plain { padding-bottom: 4px; }
.card-title { font-size: 18px; font-weight: 500; color: var(--heading); }
.card-sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.card-body { padding: 24px; }
.card-head + .card-body { padding-top: 12px; }
.card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-soft);
}
.kebab {
    width: 28px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    color: var(--text-3);
}

/* --- İstatistik kartları ----------------------------------------------- */

.stat { padding: 24px; display: flex; flex-direction: column; gap: 2px; color: inherit; }
a.stat:hover { color: inherit; }
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.stat-label { font-size: 15px; color: var(--text-2); }
.stat-value { font-size: clamp(18px, 1.45vw, 22px); font-weight: 500; line-height: 1.4; color: var(--heading); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-sub { font-size: 13px; color: var(--text-3); margin-top: 4px; }
.stat-change { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 500; margin-top: 6px; }
.stat-change.up { color: var(--green); }
.stat-change.down { color: var(--red); }
.stat-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    background: var(--primary-soft);
    color: var(--primary);
}
.tone-amber .stat-icon, .stat-icon.tone-amber { background: var(--amber-bg); color: var(--amber-solid); }
.tone-red .stat-icon, .stat-icon.tone-red { background: var(--red-bg); color: var(--red); }
.tone-blue .stat-icon, .stat-icon.tone-blue { background: var(--blue-bg); color: var(--blue-solid); }
.tone-green .stat-icon, .stat-icon.tone-green { background: var(--green-bg); color: var(--green-solid); }
.tone-violet .stat-icon, .stat-icon.tone-violet { background: var(--primary-soft); color: var(--primary); }

/* Karşılama kartı */
.welcome { display: flex; align-items: stretch; overflow: hidden; min-height: 200px; }
.welcome-body { flex: 1; padding: 24px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.welcome-title { font-size: 18px; font-weight: 500; color: var(--primary); }
.welcome-text { max-width: 440px; }
.welcome-text strong { color: var(--heading); font-weight: 600; }
.welcome-art { flex: 0 0 auto; display: flex; align-items: flex-end; padding: 16px 24px 0 0; }
.welcome-art svg { display: block; width: 210px; height: auto; }
@media (max-width: 600px) { .welcome-art { display: none; } }

/* Tahsilat oranı göstergesi */
.chart-split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.chart-split > :last-child { border-left: 1px solid var(--border-soft); }
@media (max-width: 900px) {
    .chart-split { grid-template-columns: minmax(0, 1fr); }
    .chart-split > :last-child { border-left: 0; border-top: 1px solid var(--border-soft); }
}
.gauge-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 32px 24px; text-align: center; }
.gauge { position: relative; width: 180px; height: 160px; }
.gauge svg { display: block; width: 180px; height: 180px; }
.gauge-value { position: absolute; left: 0; right: 0; top: 56px; text-align: center; }
.gauge-value strong { display: block; font-size: 22px; font-weight: 500; color: var(--heading); }
.gauge-value span { font-size: 15px; color: var(--text-2); }
.gauge-caption { font-weight: 500; color: var(--heading); }
.mini-stats { display: flex; gap: 24px; flex-wrap: wrap; justify-content: center; }
.mini-stat { display: flex; align-items: center; gap: 10px; text-align: left; }
.mini-stat .stat-icon { width: 38px; height: 38px; }
.mini-stat small { display: block; font-size: 13px; color: var(--text-2); }
.mini-stat strong { display: block; font-weight: 500; color: var(--heading); font-variant-numeric: tabular-nums; }

/* --- Butonlar ------------------------------------------------------------ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font: 500 15px/1 var(--font);
    letter-spacing: .2px;
    cursor: pointer;
    white-space: nowrap;
    transition: all .2s ease-in-out;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .65; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-primary); }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-secondary { background: var(--gray-bg); color: var(--gray); }
.btn-secondary:hover { background: #dfe3e7; color: var(--gray); }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-soft); color: var(--primary); }
.btn-label { background: var(--primary-soft); color: var(--primary); }
.btn-label:hover { background: var(--primary); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text-2); transform: none; }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-success { background: var(--green-solid); color: #fff; box-shadow: 0 .125rem .25rem 0 rgba(113, 221, 55, .4); }
.btn-success:hover { background: #67c932; color: #fff; }
.btn-alert { background: var(--red); color: #fff; box-shadow: 0 .125rem .25rem 0 rgba(255, 62, 29, .4); }
.btn-alert:hover { background: #e6381a; color: #fff; }
.btn-wa { background: #25d366; color: #fff; box-shadow: 0 .125rem .25rem 0 rgba(37, 211, 102, .4); }
.btn-wa:hover { background: #1ebe5b; color: #fff; }
.btn-sm { height: 31px; padding: 0 14px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-lg { height: 48px; padding: 0 26px; font-size: 17px; border-radius: var(--radius-lg); }
.btn-block { width: 100%; }
.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
    transition: background .15s, color .15s;
}
.btn-icon:hover { background: var(--surface-3); color: var(--heading); }
.btn-icon.danger:hover { background: var(--red-bg); color: var(--red); }

/* --- Rozetler ------------------------------------------------------------ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px;
    border-radius: var(--radius-sm);
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: .3px;
    text-transform: uppercase;
    white-space: nowrap;
    background: var(--gray-bg);
    color: var(--gray);
}
.badge-satis, .badge-amber { background: var(--amber-bg); color: var(--amber-solid); }
.badge-tahsilat, .badge-green, .badge-giris { background: var(--green-bg); color: var(--green-solid); }
.badge-alis, .badge-violet { background: var(--primary-soft); color: var(--primary); }
.badge-odeme, .badge-red, .badge-cikis { background: var(--red-bg); color: var(--red); }
.badge-devir, .badge-blue { background: var(--blue-bg); color: var(--blue-solid); }

/* --- Bakiye gösterimi ------------------------------------------------------ */

.amount { font-weight: 500; color: var(--heading); font-variant-numeric: tabular-nums; white-space: nowrap; }
.amount-alacak { color: var(--amber); }
.amount-borc { color: var(--red); }
.amount-kapali { color: var(--text-3); }
.amount-giris { color: var(--green); }
.amount-cikis { color: var(--red); }
.balance { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; }
.balance small { font-size: 12.5px; color: var(--text-3); }

.balance-hero {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 20px;
    border-radius: var(--radius-lg);
    background: var(--surface-3);
}
.balance-hero.alacak { background: var(--amber-bg); }
.balance-hero.borc { background: var(--red-bg); }
.balance-hero-label { font-size: 13px; color: var(--text-2); text-transform: uppercase; letter-spacing: .4px; }
.balance-hero-value { font-size: 30px; font-weight: 600; color: var(--heading); font-variant-numeric: tabular-nums; }
.balance-hero.alacak .balance-hero-value { color: var(--amber); }
.balance-hero.borc .balance-hero-value { color: var(--red); }
.balance-hero-status { font-weight: 500; }

/* --- Tablolar ------------------------------------------------------------ */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
    padding: 14px 20px;
    text-align: left;
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--heading);
    border-top: 1px solid var(--border-soft);
    border-bottom: 1px solid var(--border-soft);
    white-space: nowrap;
}
.table td { padding: 13px 20px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table th.num, .table td.num { text-align: right; }
.table .row-actions { display: flex; justify-content: flex-end; align-items: center; gap: 2px; }
.table tr.devir-row td { background: var(--surface-3); font-weight: 500; color: var(--heading); }
.table tfoot td { padding: 14px 20px; font-weight: 600; color: var(--heading); border-top: 1px solid var(--border-soft); }
.cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-title { font-weight: 500; color: var(--heading); }
.cell-title:hover { color: var(--primary); }
.cell-sub { font-size: 13px; color: var(--text-3); }
.cell-text { min-width: 0; }
.table-card .table th:first-child, .table-card .table td:first-child { padding-left: 24px; }
.table-card .table th:last-child, .table-card .table td:last-child { padding-right: 24px; }

/* Mobilde cari listesi kart görünümüne geçer. */
@media (max-width: 720px) {
    .table-stack thead { display: none; }
    .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
    .table-stack tr { position: relative; padding: 14px 16px; border-bottom: 1px solid var(--border-soft); }
    .table-stack td { padding: 0; border: 0; }
    .table-stack td:first-child { padding-right: 120px; }
    .table-stack td.stack-hide { display: none; }
    .table-stack td.stack-end { position: absolute; right: 16px; top: 16px; width: auto; }
    .table-stack td.stack-actions { margin-top: 10px; }
    .table-stack .row-actions { justify-content: flex-start; }
    .table-stack tbody tr:hover td { background: transparent; }
    .table-card .table-stack td:first-child { padding-left: 0; }
}

/* --- Liste ---------------------------------------------------------------- */

.list { display: flex; flex-direction: column; padding: 4px 0 12px; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 10px 24px; }
.list-main { flex: 1; min-width: 0; }
.list-title {
    display: block;
    font-weight: 500;
    color: var(--heading);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
a.list-title:hover { color: var(--primary); }
.list-sub { display: block; font-size: 13px; color: var(--text-3); }
.list-end { display: flex; align-items: center; gap: 8px; }

/* --- Avatar -------------------------------------------------------------- */

.avatar {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 500;
}
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }
.av-0 { background: var(--primary-soft); color: var(--primary); }
.av-1 { background: var(--green-bg); color: var(--green-solid); }
.av-2 { background: var(--amber-bg); color: var(--amber-solid); }
.av-3 { background: var(--red-bg); color: var(--red); }
.av-4 { background: var(--blue-bg); color: var(--blue-solid); }
.av-5 { background: var(--gray-bg); color: var(--gray); }

/* --- Formlar ------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: .25px;
    text-transform: uppercase;
    color: var(--heading);
}
.label .faint { text-transform: none; letter-spacing: 0; font-weight: 400; }
.input {
    width: 100%;
    height: 38px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-2);
    font: 15px var(--font);
    transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--text-3); }
.input:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
.input:disabled { background: var(--surface-3); }
textarea.input { height: auto; min-height: 90px; padding: 9px 14px; resize: vertical; line-height: 1.53; }
select.input { padding-right: 34px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23697a8d' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input-lg { height: 50px; font-size: 21px; font-weight: 500; color: var(--heading); font-variant-numeric: tabular-nums; }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-icon .input { padding-left: 40px; }
.input-money { position: relative; }
.input-money .input { padding-right: 38px; }
.input-money span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-weight: 500; font-size: 16px; }
.hint { font-size: 13px; color: var(--text-3); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.form-section + .form-section { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border-soft); }
.form-section-title { font-size: 16px; font-weight: 500; margin-bottom: 2px; }
.form-section-sub { font-size: 13px; color: var(--text-3); margin-bottom: 18px; }
.form-error { padding: 12px 16px; border-radius: var(--radius); background: var(--red-bg); color: var(--red); }

/* Seçim kutucukları (segment) */
.segmented {
    display: flex;
    gap: 4px;
    padding: 4px;
    border-radius: var(--radius-lg);
    background: var(--surface-3);
}
.segmented label { flex: 1; position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 14px;
    color: var(--text-2);
    cursor: pointer;
    user-select: none;
    transition: background .15s, color .15s, box-shadow .15s;
}
.segmented span:hover { color: var(--heading); }
.segmented input:checked + span { background: var(--primary); color: #fff; box-shadow: var(--shadow-primary); }
.segmented input:focus-visible + span { box-shadow: var(--focus), 0 0 0 2px var(--primary-soft); }
.seg-satis input:checked + span { background: var(--amber-solid); box-shadow: 0 .125rem .25rem 0 rgba(255, 171, 0, .4); }
.seg-tahsilat input:checked + span, .seg-giris input:checked + span { background: var(--green-solid); box-shadow: 0 .125rem .25rem 0 rgba(113, 221, 55, .4); }
.seg-odeme input:checked + span, .seg-cikis input:checked + span { background: var(--red); box-shadow: 0 .125rem .25rem 0 rgba(255, 62, 29, .4); }
.seg-devir input:checked + span, .seg-virman input:checked + span { background: var(--blue-solid); box-shadow: 0 .125rem .25rem 0 rgba(3, 195, 236, .4); }

/* Filtre çipleri (hap menü) */
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip {
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 16px;
    border-radius: var(--radius);
    color: var(--text-2);
    font-size: 14px;
    font-weight: 500;
}
.chip:hover { color: var(--primary); }
.chip.active { background: var(--primary); color: #fff; box-shadow: var(--shadow-primary); }

.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 20px 24px; }
.toolbar .input-icon { flex: 1; min-width: 200px; max-width: 360px; }
.toolbar select.input { width: auto; }

/* --- Modal --------------------------------------------------------------- */

body.modal-acik { overflow: hidden; }
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 7vh 16px 16px;
    background: rgba(67, 89, 113, .5);
    overflow-y: auto;
    animation: fade .15s ease;
}
.modal-box {
    width: 100%;
    max-width: 500px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: pop .2s ease;
}
.modal-wide { max-width: 640px; }
.modal-head { position: relative; display: flex; align-items: center; justify-content: space-between; padding: 24px 24px 4px; }
.modal-head h2 { font-size: 18px; font-weight: 500; }
.modal-head .btn-icon {
    position: absolute;
    right: -10px;
    top: -10px;
    width: 34px;
    height: 34px;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.modal-head .btn-icon:hover { transform: translate(-2px, 2px); background: var(--surface); }
.modal-body { display: flex; flex-direction: column; gap: 18px; padding: 16px 24px 8px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px 24px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(-20px); } }
@media (max-width: 560px) {
    .modal { padding: 0; align-items: flex-end; }
    .modal-box { border-radius: 14px 14px 0 0; max-height: 94vh; overflow-y: auto; }
    .modal-head .btn-icon { right: 12px; top: 12px; }
}

/* Hızlı işlem: cari seçimi */
.picked {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 8px 8px 12px;
    border-radius: var(--radius);
    background: var(--surface-3);
}
.picked-text { flex: 1; min-width: 0; line-height: 1.3; }
.picked-text strong { display: block; font-weight: 500; color: var(--heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picked-text small { font-size: 13px; }
.suggest-wrap { position: relative; }
.suggest {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 5;
    max-height: 320px;
    overflow-y: auto;
    padding: 6px 0;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.suggest-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    border: 0;
    background: transparent;
    color: var(--text-2);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.suggest-item:hover, .suggest-item.active { background: var(--primary-soft); }
.suggest-item .list-main { line-height: 1.3; }
.suggest-empty { padding: 12px 16px; color: var(--text-3); text-align: center; }
.tip-desc { margin-top: -10px; font-size: 13px; color: var(--text-3); }

.suggest.suggest-floating { position: fixed; right: auto; z-index: 300; }

/* --- Fatura formu ------------------------------------------------------------ */

.form-grid.fatura-ust { grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .form-grid.fatura-ust { grid-template-columns: repeat(3, minmax(0, 1fr)); } .fatura-ust > :first-child { grid-column: 1 / -1; } }
@media (max-width: 640px) { .form-grid.fatura-ust { grid-template-columns: minmax(0, 1fr); } }

.lines-table th { padding: 12px 8px; }
.lines-table td { padding: 8px; vertical-align: top; border-bottom: 1px solid var(--border-soft); }
.lines-table tbody tr:hover td { background: transparent; }
.lines-table .input { height: 38px; padding: 0 10px; }
.lines-table .num-input { text-align: right; font-variant-numeric: tabular-nums; }
.lines-table .col-sira { width: 36px; padding-top: 17px; text-align: center; color: var(--text-3); font-size: 13px; }
.lines-table .col-aciklama { min-width: 260px; }
.lines-table .col-miktar { width: 100px; min-width: 90px; }
.lines-table .col-birim { width: 104px; min-width: 96px; }
.lines-table .col-fiyat { width: 140px; min-width: 120px; }
.lines-table .col-isk { width: 84px; min-width: 76px; }
.lines-table .col-kdv { width: 92px; min-width: 84px; }
.lines-table .col-toplam { width: 130px; padding-top: 17px; text-align: right; font-weight: 500; color: var(--heading); white-space: nowrap; font-variant-numeric: tabular-nums; }
.lines-table .col-sil { width: 44px; padding-top: 9px; }
.table-card .lines-table th:first-child, .table-card .lines-table td:first-child { padding-left: 16px; }
.table-card .lines-table th:last-child, .table-card .lines-table td:last-child { padding-right: 16px; }
.urun-etiket { display: flex; align-items: center; gap: 4px; margin-top: 5px; font-size: 12px; color: var(--primary); }
.totals { display: flex; flex-direction: column; gap: 12px; }
.totals-row { display: flex; justify-content: space-between; gap: 12px; color: var(--text-2); }
.totals-row strong { color: var(--heading); font-weight: 500; font-variant-numeric: tabular-nums; }
.totals-grand { padding-top: 14px; border-top: 1px dashed var(--border); align-items: baseline; }
.totals-grand span { font-weight: 500; color: var(--heading); }
.totals-grand strong { font-size: 26px; font-weight: 600; color: var(--primary); }
.check-row { display: inline-flex; align-items: center; gap: 10px; color: var(--heading); cursor: pointer; user-select: none; }
.check-row input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.pesin-box { padding: 16px; border-radius: var(--radius-lg); background: var(--surface-3); display: flex; flex-direction: column; gap: 14px; }

/* Fatura görüntüleme */
.doc-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.doc-meta .fact-value { font-size: 15px; }
@media (max-width: 900px) { .doc-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.doc-words { font-size: 13px; color: var(--text-3); text-align: right; }

/* --- Bildirimler ----------------------------------------------------------- */

.flashes { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.flash {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius);
    animation: pop .2s ease;
}
.flash-basari { background: var(--green-bg); color: #4ea81f; }
.flash-hata { background: var(--red-bg); color: var(--red); }
.flash-bilgi { background: var(--blue-bg); color: var(--blue); }
.flash .btn-icon { margin-left: auto; color: inherit; width: 26px; height: 26px; }

/* --- Boş durum ----------------------------------------------------------- */

.empty { padding: 36px 24px 40px; text-align: center; color: var(--text-2); }
.empty-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 14px;
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    background: var(--primary-soft);
    color: var(--primary);
}
.empty h3 { font-size: 16px; margin-bottom: 4px; }
.empty .btn { margin-top: 16px; }

/* --- Sayfalama ----------------------------------------------------------- */

.pagination { display: flex; align-items: center; gap: 8px; }

/* --- Grafik (saf CSS sütun grafik) ------------------------------------- */

.legend { display: flex; gap: 18px; font-size: 13px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-satis { background: var(--primary); }
.dot-tahsilat { background: var(--blue-solid); }
.bars {
    display: flex;
    align-items: stretch;
    gap: 10px;
    height: 240px;
    padding-top: 8px;
    background-image: repeating-linear-gradient(to top, var(--border-soft) 0 1px, transparent 1px 48px);
    background-position: 0 -24px;
}
.bar-group { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.bar-pair { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 6px; }
.bar { width: min(18px, 36%); min-height: 6px; border-radius: 10px; transition: opacity .15s; }
.bar:hover { opacity: .8; }
.bars-dense { gap: 3px; height: 180px; }
.bars-dense .bar-pair { gap: 2px; }
.bars-dense .bar { width: min(7px, 45%); min-height: 3px; border-radius: 4px; }
.bars-dense .bar-label { font-size: 11px; }
.bar-giren { background: var(--green-solid); }
.bar-cikan { background: var(--red); }
.bar-satis { background: var(--primary); }
.bar-tahsilat { background: var(--blue-solid); }
.bar-label { text-align: center; font-size: 13px; color: var(--text-3); }

/* --- Cari detay başlığı ---------------------------------------------------- */

.profile { display: flex; align-items: flex-start; gap: 18px; }
.profile-name { font-size: 22px; font-weight: 500; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; color: var(--text-2); font-size: 14px; }
.profile-meta span, .profile-meta a { display: inline-flex; align-items: center; gap: 6px; }
.action-bar { display: flex; flex-wrap: wrap; gap: 10px; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.fact { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-3); }
.fact-label { font-size: 13px; color: var(--text-3); }
.fact-value { font-weight: 500; color: var(--heading); font-variant-numeric: tabular-nums; }
.progress { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, .7); overflow: hidden; margin-top: 10px; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--amber-solid); }
.progress.over span { background: var(--red); }
@media (max-width: 640px) { .facts { grid-template-columns: minmax(0, 1fr); } }

/* Kasa kartları */
.account { display: flex; flex-direction: column; gap: 16px; padding: 24px; color: inherit; transition: box-shadow .2s, transform .2s; }
.account:hover { color: inherit; box-shadow: var(--shadow); transform: translateY(-2px); }
.account-top { display: flex; align-items: center; gap: 12px; }
.account-value { font-size: 22px; font-weight: 500; color: var(--heading); font-variant-numeric: tabular-nums; }
.account-new {
    display: grid;
    place-items: center;
    min-height: 150px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    background: transparent;
    color: var(--text-2);
    font: 500 15px var(--font);
    cursor: pointer;
    transition: all .2s;
}
.account-new:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

/* Başlangıç rehberi */
.onboarding { display: flex; gap: 20px; align-items: center; padding: 24px; margin-bottom: 24px; }
.steps { display: flex; gap: 10px 20px; flex-wrap: wrap; margin-top: 10px; }
.step { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); }
.step b {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
}

/* --- Giriş / kayıt -------------------------------------------------------- */

.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.auth-box { width: 100%; max-width: 440px; }
.auth-brand { display: flex; justify-content: center; }
.auth-brand .brand { margin: 0; padding: 0; height: auto; }
.auth-card .auth-brand { margin-bottom: 28px; }
.auth-card { padding: 40px 32px; }
.auth-card h1 { font-size: 21px; margin-bottom: 4px; }
.auth-card form { display: flex; flex-direction: column; gap: 18px; margin-top: 22px; }
.auth-alt { margin-top: 18px; text-align: center; color: var(--text-2); }

/* --- Telefon: alt menü, işlem menüsü, kart görünümleri ---------------------- */

html { -webkit-tap-highlight-color: transparent; }
.bottom-nav { display: none; }
.show-mobile { display: none; }
.sidebar-install { padding: 16px 16px 0; margin-top: auto; }
.ios-ipucu { align-items: flex-start; font-size: 13px; cursor: default; }
.ios-ipucu:hover { background: transparent; }
.sheet-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding-bottom: 8px; }
.sheet-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 18px 8px;
    border: 0;
    border-radius: 12px;
    background: var(--surface-3);
    color: var(--heading);
    font: 500 13.5px var(--font);
    text-align: center;
    cursor: pointer;
}
.sheet-btn:hover { color: var(--heading); background: var(--primary-soft); }
.sheet-btn .stat-icon { width: 46px; height: 46px; border-radius: 12px; }

@media (max-width: 1399px) { .hide-tablet { display: none !important; } }

@media (max-width: 720px) {
    /* iOS'ta odaklanınca sayfa yakınlaşmasın diye alanlar en az 16px. */
    .input, .topbar-search input { font-size: 16px; }
    .page-title { font-size: 20px; }
    .page-head { margin-bottom: 18px; }
    .page-actions { width: 100%; }
    .page-actions > .btn { flex: 1; }
    .card-head { padding: 18px 16px 10px; }
    .card-body { padding: 16px; }
    .card-foot { padding: 14px 16px; }
    .toolbar { padding: 14px 16px; }
    .list-item { padding: 10px 16px; }
    .table-card .table th:first-child, .table-card .table td:first-child { padding-left: 16px; }
    .table-card .table th:last-child, .table-card .table td:last-child { padding-right: 16px; }
    .grid { gap: 16px; }
    .mt-4 { margin-top: 16px; }
    .stat { padding: 18px; }
    .welcome-body { padding: 20px; }
    .profile-name { font-size: 19px; }
    .action-bar .btn { flex: 1 1 auto; }

    .bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 40;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        align-items: end;
        padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
        background: var(--surface);
        box-shadow: 0 -2px 14px rgba(67, 89, 113, .14);
    }
    .bottom-nav a, .bottom-nav button {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        padding: 6px 0 2px;
        border: 0;
        background: none;
        color: var(--text-3);
        font: 500 11px var(--font);
        cursor: pointer;
    }
    .bottom-nav .active { color: var(--primary); }
    .bottom-nav .fab {
        width: 56px;
        height: 56px;
        margin: -28px auto 2px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
        background: var(--primary);
        color: #fff;
        box-shadow: 0 6px 16px -4px rgba(105, 108, 255, .65), 0 0 0 5px var(--bg);
    }
    .content { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
    .sheet-grid { gap: 10px; }

    /* Tablolar kart görünümünde */
    .show-mobile { display: block; }
    th.show-mobile { display: none; }
    .table-stack td.stack-inline { display: inline-block; width: auto; margin: 0 8px 4px 0; padding-right: 0 !important; }
    .table-stack tfoot { display: none; }
    .table-stack tr.devir-row td { display: inline-block; width: auto; margin-right: 8px; }

    /* Fatura satırları kart görünümünde */
    .lines-table thead { display: none; }
    .lines-table, .lines-table tbody { display: block; }
    .lines-table tr { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--border-soft); }
    .lines-table td { display: block; width: auto !important; min-width: 0 !important; padding: 0 !important; border: 0; }
    .lines-table .col-sira { display: none; }
    .lines-table .col-aciklama { grid-column: 1 / -1; padding-right: 44px !important; }
    .lines-table .col-miktar, .lines-table .col-birim, .lines-table .col-fiyat,
    .lines-table .col-isk, .lines-table .col-kdv, .lines-table .col-toplam { grid-column: span 2; }
    .lines-table .col-toplam { align-self: center; font-size: 15px; }
    .lines-table .col-sil { position: absolute; top: 14px; right: 10px; }
}

/* Telefona yüklenmiş uygulama: çentik / durum çubuğu boşluğu */
html.pwa .topbar { padding-top: max(12px, env(safe-area-inset-top)); }
html.pwa .sidebar { padding-top: env(safe-area-inset-top); }

/* --- Yazdırma -------------------------------------------------------------- */

@media print {
    .sidebar, .topbar, .no-print, .row-actions, .flashes { display: none !important; }
    .main { margin: 0; }
    .content { padding: 0; }
    .card { box-shadow: none; }
    body { background: #fff; }
}
