/* ==========================================================================
   Işık Kule — tasarım sistemi
   - Açık tema varsayılan; koyu tema <html data-theme="dark"> ile açılır.
   - Tema, layout <head> içindeki küçük betikle seçilir: kayıtlı tercih yoksa telefonun ayarı.
   - Sayfalarda sabit renk yazmayın; buradaki değişkenleri kullanın (iki temada da çalışsın).
   ========================================================================== */

/* Inter (değişken font, 400-700) sunucudan servis edilir; Google Fonts'a bağlantı gerekmez */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('/assets/fonts/inter-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('/assets/fonts/inter-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Renkler ve ölçüler ---------- */
:root {
    color-scheme: light;

    --bg: #f3f5f9;
    --bg-card: #ffffff;
    --bg-hover: #eef1f6;
    --bg-sunken: #e7ebf2;
    --bg-raised: #ffffff;
    --overlay: rgba(15, 23, 42, 0.5);

    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #5b6a7f;

    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    --primary: #1d4ed8;
    --primary-hover: #1e40af;
    --primary-text: #1d4ed8;
    --primary-soft: #e0e9ff;
    --on-primary: #ffffff;
    --focus-ring: rgba(29, 78, 216, 0.35);

    --success: #15803d;
    --success-bg: #dcfce7;
    --success-solid: #16a34a;
    --warning: #b45309;
    --warning-bg: #fef3c7;
    --warning-solid: #d97706;
    --danger: #b91c1c;
    --danger-bg: #fee2e2;
    --danger-solid: #dc2626;
    --info: #1d4ed8;
    --info-bg: #e0e9ff;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.07), 0 6px 16px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.18);

    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 18px;
    --app-bar-h: 60px;
    --bottom-nav-h: 66px;
    --sidebar-w: 252px;
    --ease: cubic-bezier(0.2, 0, 0, 1);
}

:root[data-theme="dark"] {
    color-scheme: dark;

    --bg: #0b1018;
    --bg-card: #131a25;
    --bg-hover: #1b2432;
    --bg-sunken: #0d131c;
    --bg-raised: #222d3d;
    --overlay: rgba(0, 0, 0, 0.62);

    --text: #e8edf4;
    --text-secondary: #a7b2c3;
    --text-muted: #8391a6;

    --border: #233042;
    --border-strong: #33425b;

    --primary: #2563eb;
    --primary-hover: #3b82f6;
    --primary-text: #93b4fd;
    --primary-soft: rgba(59, 130, 246, 0.17);
    --on-primary: #ffffff;
    --focus-ring: rgba(147, 180, 253, 0.45);

    --success: #4ade80;
    --success-bg: rgba(74, 222, 128, 0.13);
    --success-solid: #22c55e;
    --warning: #fbbf24;
    --warning-bg: rgba(251, 191, 36, 0.13);
    --warning-solid: #f59e0b;
    --danger: #f87171;
    --danger-bg: rgba(248, 113, 113, 0.13);
    --danger-solid: #ef4444;
    --info: #93b4fd;
    --info-bg: rgba(59, 130, 246, 0.17);

    --shadow-sm: none;
    --shadow: none;
    --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.55);
}

/* ---------- Temel ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4 {
    line-height: 1.25;
    font-weight: 700;
}

a {
    color: var(--primary-text);
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button {
    background: none;
    border: 0;
    cursor: pointer;
    touch-action: manipulation;
}

[hidden] {
    display: none !important;
}

svg.lucide {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.tabular {
    font-variant-numeric: tabular-nums;
}

.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }

.stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ---------- Uygulama iskeleti ---------- */
.app-shell {
    min-height: 100vh;
    min-height: 100dvh;
}

.app-main {
    min-width: 0;
}

.app-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 8px;
    height: calc(var(--app-bar-h) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 8px 0 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.app-bar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.app-title {
    font-size: 19px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.icon-button {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: var(--text-secondary);
    transition: background-color 0.15s, color 0.15s;
}

.icon-button:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.icon-button:active {
    background: var(--bg-sunken);
}

.show-in-dark { display: none; }
:root[data-theme="dark"] .show-in-dark { display: block; }
:root[data-theme="dark"] .show-in-light { display: none; }

.main-content {
    max-width: 1040px;
    margin: 0 auto;
    padding: 16px 16px calc(var(--bottom-nav-h) + env(safe-area-inset-bottom) + 28px);
}

/* Alt sekme çubuğu (telefon) */
.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
    padding: 0 4px env(safe-area-inset-bottom);
    background: var(--bg-card);
    border-top: 1px solid var(--border);
}

.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.bottom-nav .nav-icon {
    display: grid;
    place-items: center;
    width: 56px;
    height: 30px;
    border-radius: 999px;
    transition: background-color 0.2s var(--ease);
}

.bottom-nav .nav-icon svg.lucide {
    width: 22px;
    height: 22px;
}

.bottom-nav a.active {
    color: var(--primary-text);
}

.bottom-nav a.active .nav-icon {
    background: var(--primary-soft);
}

.bottom-nav .nav-label {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Yan menü (masaüstü) */
.sidebar {
    display: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 0 14px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: background-color 0.15s, color 0.15s;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.nav-item.active {
    background: var(--primary-soft);
    color: var(--primary-text);
}

@media (min-width: 1024px) {
    .app-shell {
        display: grid;
        grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    }

    .sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        height: 100dvh;
        display: flex;
        flex-direction: column;
        gap: 4px;
        padding: 20px 14px;
        background: var(--bg-card);
        border-right: 1px solid var(--border);
    }

    .sidebar-brand {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 6px 14px 20px;
        font-size: 18px;
        font-weight: 700;
    }

    .sidebar-foot {
        margin-top: auto;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .sidebar-credit {
        padding: 12px 14px 0;
        font-size: 12px;
        color: var(--text-muted);
    }

    .sidebar-credit a {
        color: var(--text-muted);
    }

    .bottom-nav {
        display: none;
    }

    .app-bar {
        padding-left: 32px;
        padding-right: 24px;
    }

    .main-content {
        padding: 28px 32px 56px;
    }
}

/* ---------- Sayfa başı araç satırı ---------- */
.page-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.page-toolbar > .search-wrapper,
.page-toolbar > .month-picker {
    flex: 1;
    min-width: 0;
}

.month-picker {
    position: relative;
    display: flex;
    align-items: center;
}

.month-picker select {
    width: 100%;
    height: 48px;
    padding: 0 44px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.month-picker > svg.lucide {
    position: absolute;
    pointer-events: none;
    color: var(--text-muted);
}

.month-picker > svg.lucide:first-child {
    left: 14px;
}

.month-picker > svg.lucide:last-child {
    right: 14px;
}

/* ---------- Kart ---------- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px 0;
}

.card-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    font-weight: 700;
}

.card-header h3 svg.lucide {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.card-subtitle {
    margin-top: 2px;
    font-size: 14px;
    color: var(--text-muted);
}

.card-body {
    padding: 16px 18px 18px;
}

.link-btn {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    min-height: 44px;
    padding: 0 4px;
    font-size: 15px;
    font-weight: 600;
    color: var(--primary-text);
}

.link-btn svg.lucide {
    width: 18px;
    height: 18px;
}

/* Açılır kart (<details>) */
.collapsible > summary {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 60px;
    padding: 0 18px;
    font-size: 17px;
    font-weight: 700;
    list-style: none;
    cursor: pointer;
}

.collapsible > summary::-webkit-details-marker {
    display: none;
}

.collapsible > summary .summary-icon {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary-text);
}

.collapsible > summary .chevron {
    margin-left: auto;
    color: var(--text-muted);
    transition: transform 0.2s var(--ease);
}

.collapsible[open] > summary .chevron {
    transform: rotate(180deg);
}

.collapsible[open] > summary {
    border-bottom: 1px solid var(--border);
}

/* ---------- Butonlar ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 18px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 12px;
    transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
    touch-action: manipulation;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.5;
    pointer-events: none;
}

.btn-primary {
    color: var(--on-primary);
    background: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    color: var(--text);
    background: var(--bg-card);
    border-color: var(--border-strong);
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-danger {
    color: var(--danger);
    background: var(--danger-bg);
}

.btn-ghost {
    color: var(--text-secondary);
    background: transparent;
}

.btn-ghost:hover {
    background: var(--bg-hover);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    min-height: 40px;
    padding: 0 14px;
    font-size: 15px;
    border-radius: 10px;
}

/* Sadece ikon olan kare buton (düzenle, sil vb.) */
.icon-btn {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    color: var(--text-secondary);
    border-radius: 12px;
    transition: background-color 0.15s, color 0.15s;
}

.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.icon-btn.danger:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

/* ---------- Formlar ---------- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group + .form-group {
    margin-top: 16px;
}

.form-group label,
.field-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    min-height: 48px;
    padding: 11px 14px;
    font-size: 16px;
    color: var(--text);
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.8;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

select.form-control {
    padding-right: 40px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%238391a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
}

textarea.form-control {
    min-height: 96px;
    resize: vertical;
}

.form-hint {
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-row .form-group + .form-group {
    margin-top: 0;
}

.form-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 24px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-row input {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

/* Arama kutusu */
.search-wrapper {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    display: flex;
    color: var(--text-muted);
    transform: translateY(-50%);
    pointer-events: none;
}

.search-input {
    width: 100%;
    height: 48px;
    padding: 0 14px 0 44px;
    font-size: 16px;
    color: var(--text);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Segmentli filtre (Tümü / Bekleyen / Ödenen) */
.segmented {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-sunken);
    border-radius: 13px;
}

.segmented > button {
    flex: 1;
    min-width: 0;
    min-height: 40px;
    padding: 0 8px;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    color: var(--text-secondary);
    border-radius: 10px;
    transition: background-color 0.15s, color 0.15s;
}

.segmented > button.active {
    color: var(--text);
    background: var(--bg-raised);
    box-shadow: var(--shadow-sm);
}

:root[data-theme="dark"] .segmented,
:root[data-theme="dark"] .choice-group {
    box-shadow: inset 0 0 0 1px var(--border);
}

.segmented .count {
    margin-left: 4px;
    font-weight: 500;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* ---------- Durum rozetleri ---------- */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px 2px 7px;
    font-size: 13px;
    font-weight: 600;
    line-height: 20px;
    border-radius: 999px;
    white-space: nowrap;
}

.status-badge svg.lucide {
    width: 14px;
    height: 14px;
    stroke-width: 2.6;
}

.status-badge.success { color: var(--success); background: var(--success-bg); }
.status-badge.info { color: var(--warning); background: var(--warning-bg); } /* kısmi ödeme */
.status-badge.danger { color: var(--danger); background: var(--danger-bg); }
.status-badge.neutral { color: var(--text-secondary); background: var(--bg-hover); }

.dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 6px;
    border-radius: 50%;
    vertical-align: 1px;
}

.dot.success { background: var(--success-solid); }
.dot.warning { background: var(--warning-solid); }
.dot.danger { background: var(--danger-solid); }

/* ---------- Özet / KPI kutuları ---------- */
.kpi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.kpi {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.kpi-wide {
    grid-column: 1 / -1;
}

.kpi-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.kpi-label svg.lucide {
    width: 17px;
    height: 17px;
    color: var(--text-muted);
}

.kpi-value {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.kpi-wide .kpi-value {
    font-size: 28px;
}

.kpi-foot {
    font-size: 13px;
    color: var(--text-muted);
}

.kpi.positive .kpi-value { color: var(--success); }
.kpi.negative .kpi-value { color: var(--danger); }

/* İlerleme çubuğu */
.progress {
    display: flex;
    height: 10px;
    overflow: hidden;
    background: var(--bg-hover);
    border-radius: 999px;
}

.progress-fill {
    height: 100%;
    background: var(--success-solid);
    transition: width 0.3s var(--ease);
}

.progress-fill.warning {
    background: var(--warning-solid);
}

/* ---------- Aidatlar ---------- */
.summary-card {
    padding: 18px;
    margin-bottom: 16px;
}

.summary-top {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
}

.summary-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.summary-value {
    display: block;
    margin-top: 2px;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.summary-sub {
    font-size: 14px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.summary-percent {
    flex-shrink: 0;
    padding: 4px 10px;
    font-size: 15px;
    font-weight: 700;
    color: var(--success);
    background: var(--success-bg);
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
}

.summary-card .progress {
    margin: 14px 0 12px;
}

.summary-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.list-tools {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.payment-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.payment-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: border-color 0.15s;
}

.payment-item.open {
    border-color: var(--border-strong);
}

.payment-row {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 72px;
    padding: 8px 6px 8px 10px;
}

/* Satırın dokunulabilir ana kısmı (detayı açar); anahtar ayrı bir buton */
.payment-main {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    min-height: 56px;
    padding: 2px;
    text-align: left;
    border-radius: 12px;
}

.payment-avatar {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    font-size: 16px;
    font-weight: 700;
    border-radius: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    background: var(--bg-hover);
}

.payment-avatar.success { color: var(--success); background: var(--success-bg); }
.payment-avatar.info { color: var(--warning); background: var(--warning-bg); }
.payment-avatar.danger { color: var(--danger); background: var(--danger-bg); }

.payment-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.payment-name {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.payment-detail {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.payment-amount {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.payment-chevron {
    width: 18px !important;
    height: 18px !important;
    color: var(--text-muted);
    transition: transform 0.2s var(--ease);
}

.payment-item.open .payment-chevron {
    transform: rotate(180deg);
}

.payment-details {
    display: none;
    padding: 4px 14px 14px;
}

.payment-item.open .payment-details {
    display: block;
}

.amount-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}

.amount-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.amount-group .label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.amount-group .value {
    display: flex;
    align-items: center;
    min-height: 44px;
    font-size: 16px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.amount-input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    font-size: 16px;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.amount-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.amount-input.saved {
    border-color: var(--success-solid);
    box-shadow: 0 0 0 3px var(--success-bg);
}

.amount-input.overpaid {
    border-color: var(--warning-solid);
}

.overpayment-indicator {
    display: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--warning);
}

.overpayment-indicator.visible {
    display: block;
}

/* Ödendi anahtarı: 44px dokunma alanı */
.toggle-payment {
    flex-shrink: 0;
    width: 60px;
    height: 48px;
    display: grid;
    place-items: center;
}

.toggle-payment:disabled {
    opacity: 0.6;
}

.toggle-track {
    position: relative;
    display: block;
    width: 52px;
    height: 32px;
    border-radius: 999px;
    background: var(--border-strong);
    transition: background-color 0.2s var(--ease);
}

.toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s var(--ease);
}

.toggle-payment.active .toggle-track {
    background: var(--success-solid);
}

.toggle-payment.active.partial .toggle-track {
    background: var(--warning-solid);
}

.toggle-payment.active .toggle-thumb {
    transform: translateX(20px);
}

.payment-item.exempt .toggle-payment {
    visibility: hidden;
}

/* ---------- Basit listeler (Daireler, son işlemler) ---------- */
.list-card {
    overflow: hidden;
}

.list-item,
.resident-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 68px;
    padding: 10px 12px 10px 16px;
}

.list-item + .list-item,
.resident-item + .resident-item {
    border-top: 1px solid var(--border);
}

.list-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.list-item-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item-subtitle {
    font-size: 14px;
    color: var(--text-muted);
}

.avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: var(--text-secondary);
    background: var(--bg-hover);
}

.avatar.success { color: var(--success); background: var(--success-bg); }
.avatar.danger { color: var(--danger); background: var(--danger-bg); }

.amount {
    font-weight: 700;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.amount.success { color: var(--success); }
.amount.danger { color: var(--danger); }

.resident-avatar {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    font-weight: 700;
    border-radius: 12px;
    color: var(--primary-text);
    background: var(--primary-soft);
    font-variant-numeric: tabular-nums;
}

.resident-info {
    flex: 1;
    min-width: 0;
}

.resident-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.resident-phone {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    font-size: 15px;
    color: var(--text-secondary);
}

a.resident-phone {
    color: var(--primary-text);
}

.resident-phone svg.lucide {
    width: 15px;
    height: 15px;
}

.resident-actions {
    display: flex;
    gap: 2px;
}

.resident-item.inactive .resident-avatar,
.resident-item.inactive .resident-info {
    opacity: 0.55;
}

/* ---------- Boş durum ---------- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state svg.lucide {
    width: 40px;
    height: 40px;
    stroke-width: 1.6;
}

.empty-state p {
    font-size: 15px;
}

/* ---------- Uyarılar ---------- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 15px;
    font-weight: 500;
    border-radius: 12px;
}

.alert svg.lucide {
    margin-top: 1px;
}

.alert-success {
    color: var(--success);
    background: var(--success-bg);
}

.alert-danger {
    color: var(--danger);
    background: var(--danger-bg);
}

/* ---------- Pencere / alt sayfa (modal) ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    background: var(--overlay);
}

.modal-overlay.open {
    display: flex;
}

.modal-sheet {
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
    background: var(--bg-card);
    border-radius: 22px 22px 0 0;
    box-shadow: var(--shadow-lg);
    animation: sheet-in 0.22s var(--ease);
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.modal-head h3 {
    font-size: 19px;
}

.modal-eyebrow {
    margin-bottom: 2px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.modal-copy {
    margin-top: 10px;
    font-size: 15px;
    color: var(--text-secondary);
}

.modal-note {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-muted);
}

.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
}

@keyframes sheet-in {
    from { transform: translateY(24px); opacity: 0; }
    to { transform: none; opacity: 1; }
}

@media (min-width: 640px) {
    .modal-overlay {
        align-items: center;
        padding: 24px;
    }

    .modal-sheet {
        border-radius: 22px;
        padding-bottom: 22px;
    }
}

/* ---------- Ayarlar ---------- */
.settings-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-card .card-body {
    padding-top: 14px;
}

.choice-group {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-sunken);
    border-radius: 13px;
}

.choice-group label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: 10px;
    cursor: pointer;
}

.choice-group input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.choice-group input:checked + label {
    color: var(--text);
    background: var(--bg-raised);
    box-shadow: var(--shadow-sm);
}

.choice-group input:focus-visible + label {
    outline: 3px solid var(--focus-ring);
}

.choice-group label svg.lucide {
    width: 18px;
    height: 18px;
}

.app-credit {
    padding: 8px 0 4px;
    font-size: 13px;
    text-align: center;
    color: var(--text-muted);
}

.app-credit a {
    color: var(--text-muted);
    text-decoration: underline;
}

/* ---------- Özet sayfası ---------- */
.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.chart-box {
    min-height: 260px;
}

@media (min-width: 900px) {
    .dashboard-grid {
        grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    }
}

/* ---------- Giriş sayfası ---------- */
.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 28px 22px 24px;
}

.auth-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 24px;
    text-align: center;
}

.auth-head h1 {
    font-size: 24px;
}

.auth-head p {
    font-size: 15px;
    color: var(--text-muted);
}

.password-field {
    position: relative;
}

.password-field .form-control {
    padding-right: 52px;
}

.password-field .icon-btn {
    position: absolute;
    top: 2px;
    right: 2px;
}

/* ---------- Geniş ekranlar ---------- */
@media (min-width: 640px) {
    .list-tools {
        flex-direction: row;
        align-items: center;
    }

    .list-tools .search-wrapper {
        flex: 1;
    }

    .list-tools .segmented {
        flex: 0 0 360px;
    }

    .amount-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .kpi-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .kpi-wide {
        grid-column: auto;
    }

    .kpi-wide .kpi-value {
        font-size: 22px;
    }

    .form-actions {
        flex-direction: row-reverse;
        justify-content: flex-start;
    }

    .form-actions .btn-block {
        width: auto;
        min-width: 140px;
    }
}

/* ---------- Yazdırma ---------- */
@media print {
    .app-bar,
    .bottom-nav,
    .sidebar,
    .no-print {
        display: none !important;
    }

    .app-shell {
        display: block;
    }

    body {
        background: #ffffff;
        color: #000000;
    }

    .main-content {
        max-width: none;
        padding: 0;
    }
}
