/* ═══════════════════════════════════════════════════════════════
   Finans Takip — app.css (tek stil dosyası)

   1. Tasarım değişkenleri + koyu mod     (docs/03-EKRANLAR-UI.md §D)
   2. iOS / Safari zorunlu kurallar       (§A)
   3. Temel tipografi
   4. Düzen: kabuk, üst çubuk, sayfa
   5. Kart
   6. Buton
   7. Form
   8. Liste satırı
   9. Alt sekme çubuğu
   10. Mesajlar (flash)
   11. Kurulum / giriş ekranları + PIN tuş takımı
   12. Yardımcılar
   13. Hareket azaltma
   ═══════════════════════════════════════════════════════════════ */


/* ─── 1. Tasarım değişkenleri ────────────────────────────────── */

:root {
    --bg: #f5f6fa;
    --surface: #ffffff;
    --surface-2: #eef0f6;          /* input zemini, basılı hâl */
    --text: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;

    --in: #16a34a;                 /* gelen — başka yerde yeşil kullanılmaz */
    --out: #dc2626;                /* çıkan — başka yerde kırmızı kullanılmaz */
    --accent: #4f46e5;             /* birincil aksiyon */
    --accent-text: #ffffff;
    --accent-fg: #4f46e5;          /* vurgu rengi YAZI olarak (bağlantı, aktif sekme) */
    --warn: #f59e0b;

    --radius: 16px;
    --radius-sm: 12px;
    --pad: 16px;

    --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 2px 8px rgba(15, 23, 42, .06);
    --bar-bg: rgba(245, 246, 250, .86);
    --focus: rgba(79, 70, 229, .28);

    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;

    color-scheme: light;
}

/* Sistem koyu moddaysa — kullanıcı ayarlardan açığa zorlamadıysa */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0b1020;
        --surface: #151b2e;
        --surface-2: #1d2540;
        --text: #e8eaf2;
        --muted: #94a3b8;
        --line: #26304a;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3);
        --bar-bg: rgba(11, 16, 32, .86);
        --focus: rgba(129, 140, 248, .4);
        --accent-fg: #a5b4fc;
        color-scheme: dark;
    }
}

/* Ayarlardan koyu mod zorlanmış */
:root[data-theme="dark"] {
    --bg: #0b1020;
    --surface: #151b2e;
    --surface-2: #1d2540;
    --text: #e8eaf2;
    --muted: #94a3b8;
    --line: #26304a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --bar-bg: rgba(11, 16, 32, .86);
    --focus: rgba(129, 140, 248, .4);
    --accent-fg: #a5b4fc;
    color-scheme: dark;
}


/* ─── 2. iOS / Safari zorunlu kurallar (§A) ──────────────────── */

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Dokunma hissi */
* {
    -webkit-tap-highlight-color: transparent;
}

html {
    /* Yatay çevirmede iOS yazıları kendiliğinden büyütmesin */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    background: var(--bg);
}

/* Tam yükseklik: 100vh iOS'ta adres çubuğu yüzünden bozulur → 100dvh */
html,
body {
    height: 100%;
}

.app-shell {
    min-height: 100dvh;
}

body {
    margin: 0;
    overscroll-behavior-y: none;
}

/* Safari input'a dokununca zoom yapmasın: en az 16px */
input,
select,
textarea,
button {
    font-size: 16px;
}

/* Dokunulabilir her şey en az 44×44 */
button,
.btn,
.row-link {
    min-height: 44px;
    touch-action: manipulation;
}

/* Yatay taşma yok — geniş tablolar kendi kabında kayar */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Sayfa içeriği alt sekme çubuğunun altında kaybolmasın */
.page {
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
}

/* Alt sekme çubuğu home bar'ın altında kalmasın → bölüm 9 */

/*
 * Üst güvenli alan (çentik / Dynamic Island):
 * §A :root'a padding-top veriyor; ama bu dolgu kaydırınca kayıp gidiyor ve
 * yapışkan üst çubuk durum çubuğunun altına giriyor. Bu yüzden dolgu,
 * zemini çentik alanını da kaplayan .topbar'a (üst çubuk yoksa .page--auth'a)
 * verildi — aynı güvenli alan, kaydırmada da korunur.
 */


/* ─── 3. Temel tipografi ─────────────────────────────────────── */

body {
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    overflow-wrap: break-word;
}

h1, h2, h3 {
    margin: 0;
    line-height: 1.25;
    font-weight: 700;
}

p {
    margin: 0;
}

a {
    color: var(--accent-fg);
}

strong {
    font-weight: 600;
}

/* Para rakamları hizalı dursun */
.money,
.row-value,
.input--money {
    font-variant-numeric: tabular-nums;
}

.money {
    white-space: nowrap;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}


/* ─── 4. Düzen ───────────────────────────────────────────────── */

.app-shell {
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 52px;
    padding: calc(8px + env(safe-area-inset-top, 0px))
             max(var(--pad), env(safe-area-inset-right, 0px))
             8px
             max(var(--pad), env(safe-area-inset-left, 0px));
    background: var(--bar-bg);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid var(--line);
}

.topbar-title {
    font-size: 20px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-text {
    min-width: 0;
}

.topbar-sub {
    font-size: 13px;
    color: var(--muted);
}

.topbar-icon-btn {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-right: -8px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    font-size: 20px;
    cursor: pointer;
}

.topbar-icon-btn:active {
    background: var(--surface-2);
}

.topbar-action {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 4px;
    font-weight: 600;
    text-decoration: none;
    flex-shrink: 0;
}

.page {
    flex: 1;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding-top: var(--pad);
    padding-left: max(var(--pad), env(safe-area-inset-left, 0px));
    padding-right: max(var(--pad), env(safe-area-inset-right, 0px));
}

/* Alt sekme çubuğu olmayan sayfalar */
.page--bare {
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

/* Üst çubuğu olmayan tam ekran sayfalar (kurulum, giriş) */
.page--auth {
    display: flex;
    flex-direction: column;
    padding-top: calc(24px + env(safe-area-inset-top, 0px));
    max-width: 440px;
}

.section-title {
    margin: 24px 4px 8px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--muted);
}


/* ─── 5. Kart ────────────────────────────────────────────────── */

.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: var(--pad);
    box-shadow: var(--shadow);
}

.card + .card {
    margin-top: 12px;
}

.card-title {
    font-size: 18px;
    margin-bottom: 4px;
}


/* ─── 6. Buton ───────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    transition: transform .08s ease, opacity .15s ease, background-color .15s ease;
}

.btn:active {
    transform: scale(.98);
}

.btn--primary {
    background: var(--accent);
    color: var(--accent-text);
}

.btn--secondary {
    background: var(--surface-2);
    color: var(--text);
}

.btn--danger {
    background: transparent;
    color: var(--out);
    border-color: var(--line);
}

.btn--block {
    display: flex;
    width: 100%;
}

.btn--lg {
    min-height: 52px;
    font-size: 17px;
}

.btn:disabled,
.btn[aria-disabled="true"],
.btn.is-busy {
    opacity: .55;
    pointer-events: none;
}


/* ─── 7. Form ────────────────────────────────────────────────── */

.form .btn--block {
    margin-top: 8px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
    min-width: 0;
}

.label {
    font-size: 14px;
    font-weight: 600;
}

.input,
.select,
.textarea {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 48px;
    padding: 12px 14px;
    font: inherit;
    font-size: 16px;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    -webkit-appearance: none;
    appearance: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.input::placeholder,
.textarea::placeholder {
    color: var(--muted);
    opacity: 1;
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--focus);
}

/* iOS tarih alanı: boşken çökmesin, sola hizalı olsun, kabı taşırmasın */
input[type="date"].input {
    min-height: 48px;
}

input[type="date"].input::-webkit-date-and-time-value {
    text-align: left;
    min-height: 1.5em;
}

.input-money {
    position: relative;
}

.input--money {
    padding-right: 40px;
    font-size: 20px;
    font-weight: 600;
}

.input-suffix {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    color: var(--muted);
    font-weight: 600;
    pointer-events: none;
}

.help {
    font-size: 13px;
    color: var(--muted);
}

.help--tight {
    margin: -8px 0 16px;
}

.field-error {
    font-size: 13px;
    font-weight: 500;
    color: var(--out);
}

.field.has-error .input,
.field.has-error .select,
.field.has-error .textarea {
    border-color: var(--out);
}

.note {
    margin: 4px 0 16px;
    padding: 12px 14px;
    font-size: 14px;
    color: var(--muted);
    background: var(--surface-2);
    border-radius: var(--radius-sm);
}


/* ─── 8. Liste satırı ────────────────────────────────────────── */

.list {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.row,
.row-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    padding: 12px var(--pad);
    border-bottom: 1px solid var(--line);
}

.row:last-child,
.row-link:last-child {
    border-bottom: 0;
}

.row-link {
    color: inherit;
    text-decoration: none;
}

.row-link:active {
    background: var(--surface-2);
}

.row-icon {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    font-size: 20px;
}

.row-main {
    flex: 1;
    min-width: 0;
}

.row-title {
    display: block;            /* satır içi <span>'da … kısaltması çalışmaz */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.row-sub {
    font-size: 14px;
    color: var(--muted);
}

.row-value,
.row-amount {
    flex-shrink: 0;
    max-width: 60%;
    text-align: right;
    font-weight: 600;
}

.row-amount {
    white-space: nowrap;
}


/* ─── 9. Alt sekme çubuğu ────────────────────────────────────── */

.tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 30;
    padding-top: 6px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    background: var(--bar-bg);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    backdrop-filter: saturate(180%) blur(16px);
    border-top: 1px solid var(--line);
}

.tabbar-inner {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: end;
    max-width: 640px;
    margin: 0 auto;
}

.tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
    min-width: 0;
    min-height: 48px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    touch-action: manipulation;
}

.tab-icon {
    font-size: 22px;
    line-height: 1;
}

.tab-label {
    line-height: 1.2;
}

.tab.is-active {
    color: var(--accent-fg);
}

.tab.is-disabled {
    opacity: .4;
}

/* Ortadaki büyük yuvarlak "Ekle" */
.tab-plus {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    margin-top: -20px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-text);
    font-size: 30px;
    font-weight: 400;
    line-height: 1;
    box-shadow: 0 6px 16px rgba(79, 70, 229, .35);
}

.tab--add.is-disabled {
    opacity: .55;
}


/* ─── 10. Mesajlar (flash) ───────────────────────────────────── */

.flashes {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.flash {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    font-size: 15px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--accent);
    box-shadow: var(--shadow);
}

.flash-icon {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

.flash-text {
    min-width: 0;
    padding-top: 1px;
}

.flash--success { border-left-color: var(--in); }
.flash--success .flash-icon { background: var(--in); }
.flash--error { border-left-color: var(--out); }
.flash--error .flash-icon { background: var(--out); }
.flash--warning { border-left-color: var(--warn); }
.flash--warning .flash-icon { background: var(--warn); }


/* ─── 11. Kurulum / giriş + PIN tuş takımı ───────────────────── */

.auth {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.auth-brand {
    text-align: center;
    margin-bottom: 20px;
}

.auth-logo {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    border-radius: 16px;
    background: var(--accent);
    color: var(--accent-text);
    font-size: 30px;
    font-weight: 700;
}

.auth-title {
    font-size: 22px;
}

.auth-sub {
    margin-top: 4px;
    color: var(--muted);
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Giriş: tuş takımı ekranın alt yarısında (tek elle erişim) */
.pinpad {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.pin-dots {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 4px 0 16px;
}

.pin-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--muted);
    transition: background-color .1s ease, border-color .1s ease;
}

.pin-dot.is-filled {
    background: var(--text);
    border-color: var(--text);
}

.pin-dots.is-error .pin-dot {
    border-color: var(--out);
}

.pin-dots.is-error {
    animation: pin-shake .4s ease;
}

@keyframes pin-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

.pinpad-messages {
    min-height: 48px;
}

.pin-lock {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    font-size: 15px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--warn);
    box-shadow: var(--shadow);
}

.pin-lock[hidden] {
    display: none;
}

.pin-lock-icon {
    font-size: 22px;
}

.numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 320px;
    margin: auto auto 0;       /* alta it */
    padding-top: 16px;
}

.numpad-key {
    height: clamp(52px, 8.5dvh, 68px);
    padding: 0;
    border: 0;
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
    font: inherit;
    font-size: 26px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    transition: transform .06s ease, background-color .1s ease;
}

.numpad-key:active,
.numpad-key.is-pressed {
    background: var(--surface-2);
    transform: scale(.95);
}

.numpad-key--action {
    background: transparent;
    box-shadow: none;
    font-size: 24px;
    color: var(--muted);
}

.numpad-key--submit {
    background: var(--accent);
    color: var(--accent-text);
    font-size: 17px;
    font-weight: 600;
}

.numpad-key--submit:active {
    background: var(--accent);
    opacity: .85;
}

.numpad-key:disabled,
.numpad[aria-disabled="true"] .numpad-key {
    opacity: .35;
    pointer-events: none;
}

.noscript-login {
    margin-top: 16px;
}

.noscript-login .btn {
    margin-top: 12px;
}


/* ─── 11b. Özet ekranı (§C.3) ────────────────────────────────── */

.balance-card {
    padding: 20px var(--pad);
    margin-bottom: 12px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.balance-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
}

.balance-amount {
    margin: 4px 0 2px;
    /* 320px'te de taşmasın; çok büyük tutarlar satır kırar */
    font-size: clamp(28px, 9vw, 40px);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -.02em;
    white-space: normal;
    overflow-wrap: anywhere;
}

.balance-card.is-negative .balance-amount {
    color: var(--out);
}

.balance-sub {
    font-size: 13px;
    color: var(--muted);
}

.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    min-height: 44px;
    padding: 14px;
    color: inherit;
    text-decoration: none;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-top: 3px solid transparent;
}

a.stat:active {
    background: var(--surface-2);
}

.stat-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}

.stat-value {
    font-size: clamp(17px, 5vw, 21px);
    font-weight: 700;
    line-height: 1.25;
    white-space: normal;
    overflow-wrap: anywhere;
}

.stat-hint {
    font-size: 12px;
    color: var(--muted);
}

.stat--receivable,
.stat--in { border-top-color: var(--in); }
.stat--receivable .stat-value,
.stat--in .stat-value { color: var(--in); }

.stat--payable { border-top-color: var(--warn); }
.stat--payable .stat-value { color: var(--warn); }

.stat--out { border-top-color: var(--out); }
.stat--out .stat-value { color: var(--out); }

/* Sıfır olan şirket kutusu sönük: yalnızca dolu olan dikkat çeksin */
.stat.is-zero {
    border-top-color: var(--line);
}

.stat.is-zero .stat-value {
    color: var(--muted);
}

/* Uyarı şeridi */
.alerts {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 12px 14px;
    color: inherit;
    text-decoration: none;
    background: var(--surface);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--accent);
    box-shadow: var(--shadow);
}

a.alert:active {
    background: var(--surface-2);
}

a.alert::after,
a.balance-debt::after {
    content: "";
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center / contain no-repeat;
}

a.alert::after {
    margin-left: auto;
    color: var(--muted);
}

.alert--warn { border-left-color: var(--warn); }
.alert--danger { border-left-color: var(--out); }

.alert-icon {
    font-size: 22px;
    flex-shrink: 0;
}

.alert-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.alert-title {
    font-weight: 600;
}

.alert-text {
    font-size: 13px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

/* Hızlı işlemler */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

.quick {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    min-height: 72px;
    padding: 10px 4px;
    color: var(--text);
    text-decoration: none;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    touch-action: manipulation;
}

a.quick:active {
    background: var(--surface-2);
    transform: scale(.97);
}

.quick-icon {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface-2);
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
}

.quick-label {
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
}

.quick.is-disabled {
    opacity: .45;
}

/* Bölüm başlığı + sağda bağlantı */
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.section-head .section-title {
    margin-right: auto;
}

.section-link {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 44px;
    min-height: 44px;
    margin-top: 16px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
}

/* İşlem satırı */
.tx-row .row-sub {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
}

.badge {
    display: inline-block;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.6;
    color: var(--muted);
    background: var(--surface-2);
    border-radius: 999px;
}

/* Boş durum: ikon + tek cümle + tek buton */
.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 32px 24px;
    text-align: center;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.empty-icon {
    font-size: 36px;
    line-height: 1;
}

.empty-text {
    color: var(--muted);
}


/* ─── 11c. İşlemler: form (§C.5) ─────────────────────────────── */

/* select: yerel görünüm kapalı olduğu için ok işareti */
.select {
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

.textarea {
    min-height: 88px;
    resize: vertical;
}

/* Gelir | Gider — segment düğme */
.segment {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 4px;
    padding: 4px;
    margin-bottom: 8px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
}

.segment-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segment-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 9px;
    color: var(--muted);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    transition: background-color .15s ease, color .15s ease;
}

.segment-input:checked + .segment-btn,
.segment-btn.is-selected {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
}

.segment-input:checked + .segment-btn--in,
.segment-btn--in.is-selected { color: var(--in); }

.segment-input:checked + .segment-btn--out,
.segment-btn--out.is-selected { color: var(--out); }

.segment-input:focus-visible + .segment-btn {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.segment-input:disabled + .segment-btn {
    opacity: .35;
    cursor: not-allowed;
}

.help--center,
.field-error--center {
    text-align: center;
}

/* Tutar — ekrandaki en büyük alan */
.amount-field {
    position: relative;
    margin: 12px 0 4px;
}

.amount-input {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 12px 44px;
    font: inherit;
    font-size: clamp(34px, 11vw, 44px);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: center;
    color: var(--out);
    background: transparent;
    border: 0;
    border-bottom: 2px solid var(--line);
    border-radius: 0;
    -webkit-appearance: none;
    appearance: none;
}

.tx-form[data-dir="in"] .amount-input {
    color: var(--in);
}

.amount-input::placeholder {
    color: var(--muted);
    opacity: .5;
}

.amount-input:focus {
    outline: none;
    border-bottom-color: var(--accent);
}

.amount-field.has-error .amount-input {
    border-bottom-color: var(--out);
}

.amount-suffix {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px;
    font-weight: 600;
    color: var(--muted);
    pointer-events: none;
}

/* Kategori çipleri — yatay kaydırma kendi kabında, sayfa kaymaz */
.chips-field {
    min-width: 0;
    margin: 16px 0;
    padding: 0;
    border: 0;
}

.chips-field .label {
    margin-bottom: 8px;
    padding: 0;
}

.chips {
    display: flex;
    gap: 8px;
    margin: 0 calc(-1 * var(--pad));
    padding: 2px var(--pad) 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
}

.chips::-webkit-scrollbar {
    display: none;
}

.chips[hidden] {
    display: none;
}

.chip-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    min-height: 44px;
    padding: 8px 14px;
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: var(--shadow);
    cursor: pointer;
    scroll-snap-align: start;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.chip-icon {
    font-size: 18px;
    line-height: 1;
}

.chip-input:checked + .chip {
    color: var(--accent-text);
    background: var(--accent);
    border-color: var(--accent);
}

.chip-input:focus-visible + .chip {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.chips-field.has-error .chip {
    border-color: var(--out);
}

/* Dar ekranda (iPhone SE 1. nesil) tarih + açıklama alt alta */
@media (max-width: 359px) {
    .grid-2--date {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

/* Katlanır "Gelişmiş" / "Filtre" bölümü */
.advanced {
    margin: 4px 0 16px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}

.advanced-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 14px;
    font-weight: 600;
    list-style: none;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.advanced-summary::-webkit-details-marker {
    display: none;
}

.advanced-summary::after {
    content: "▾";
    margin-left: auto;
    color: var(--muted);
    transition: transform .15s ease;
}

.advanced[open] > .advanced-summary::after {
    transform: rotate(180deg);
}

.advanced-hint {
    font-size: 13px;
    font-weight: 400;
    color: var(--muted);
}

.advanced > .field,
.advanced > .btn {
    margin-left: 14px;
    margin-right: 14px;
}

.advanced > .btn {
    width: calc(100% - 28px);
    margin-bottom: 14px;
}

.scope-hint {
    padding: 10px 12px;
    font-size: 14px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent);
}

.scope-hint[hidden],
[data-lock-note][hidden] {
    display: none;
}

.tx-form > .btn + .btn {
    margin-top: 12px;
}

/* Silme onayı */
.confirm-card {
    margin-bottom: 12px;
    text-align: center;
}

.confirm-amount {
    font-size: clamp(28px, 9vw, 36px);
    font-weight: 700;
}

.confirm-title {
    margin: 4px 0;
    font-size: 18px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.note--warn {
    border-left: 4px solid var(--warn);
    color: var(--text);
}

.btn--danger-solid {
    background: var(--out);
    color: #fff;
}

.stack-top-sm {
    margin-top: 12px;
}


/* ─── 11d. İşlemler: liste (§C.4) ────────────────────────────── */

.month-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.month-nav-btn {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    font-size: 26px;
    line-height: 1;
    text-decoration: none;
    color: var(--text);
    background: var(--surface);
    border-radius: 50%;
    box-shadow: var(--shadow);
}

.month-nav-btn:active {
    background: var(--surface-2);
}

.month-nav-label {
    font-size: 18px;
    font-weight: 700;
}

.segment--links {
    margin-bottom: 12px;
}

.filter-bar {
    margin-bottom: 12px;
}

.search-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.search-row .input {
    flex: 1;
}

.search-row .btn {
    flex-shrink: 0;
}

.input--search::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.filter-more {
    margin-bottom: 8px;
}

.clear-filters {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.totals-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    margin-bottom: 8px;
    padding: 12px 14px;
    font-size: 14px;
    color: var(--muted);
    background: var(--surface);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}

.totals-bar strong {
    font-weight: 700;
}

.totals-count {
    margin-left: auto;
}

.day-group {
    margin-top: 16px;
}

.day-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin: 0 4px 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}

.day-net {
    font-size: 13px;
}

.tx-row[id] {
    /* "Daha fazla yükle" sonrası satır yapışkan üst çubuğun altına girmesin */
    scroll-margin-top: calc(80px + env(safe-area-inset-top, 0px));
}

.tx-row.is-planned .row-title,
.tx-row.is-planned .row-amount {
    opacity: .65;
}

.badge--planned {
    color: var(--accent-fg);
}

.load-more {
    margin-top: 16px;
}


/* ─── 11e. Borç / taksit (§C.6) ──────────────────────────────── */

/* Özet kartında: borç bakiyeden düşülmez, yalnızca bilgi */
.balance-debt {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    margin-top: 12px;
    padding-top: 10px;
    font-size: 14px;
    color: var(--muted);
    text-decoration: none;
    border-top: 1px solid var(--line);
}

.balance-debt strong {
    color: var(--text);
    white-space: nowrap;
}

a.balance-debt::after {
    margin-left: -4px;
}

.debt-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.debt-summary-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.debt-summary-value {
    font-size: clamp(17px, 5vw, 21px);
    font-weight: 700;
    white-space: normal;
    overflow-wrap: anywhere;
}

.debt-card {
    margin-bottom: 12px;
    padding: var(--pad);
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--accent);
}

.debt-card.is-overdue {
    border-left-color: var(--out);
}

.debt-card.is-closed {
    border-left-color: var(--line);
    opacity: .75;
}

.debt-card-link {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 44px;
    color: inherit;
    text-decoration: none;
}

.debt-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.debt-name {
    min-width: 0;
    font-size: 17px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.debt-icon {
    font-size: 22px;
    flex-shrink: 0;
}

.debt-amount {
    font-size: 20px;
    font-weight: 700;
}

.debt-amount small {
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
}

.debt-amount--lg {
    font-size: clamp(26px, 8vw, 32px);
    margin: 4px 0 10px;
}

.progress {
    display: block;
    height: 10px;
    overflow: hidden;
    background: var(--surface-2);
    border-radius: 999px;
}

.progress-bar {
    display: block;
    height: 100%;
    background: var(--accent);
    border-radius: 999px;
}

.debt-card.is-closed .progress-bar,
.debt-detail.is-closed .progress-bar {
    background: var(--in);
}

.debt-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
}

.debt-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 16px;
    font-size: 14px;
    color: var(--muted);
}

.debt-meta strong {
    color: var(--text);
}

.debt-due {
    font-size: 14px;
}

.debt-pay {
    margin-top: 12px;
}

.debt-kind {
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
}

.debt-detail {
    margin-bottom: 12px;
}

.debt-note {
    margin-top: 12px;
    padding: 10px 12px;
    font-size: 14px;
    color: var(--muted);
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    overflow-wrap: anywhere;
}

.kv {
    margin: 14px 0 0;
}

.kv > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-top: 1px solid var(--line);
    font-size: 15px;
}

.kv dt {
    color: var(--muted);
}

.kv dd {
    margin: 0;
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.payment-row .row-icon {
    font-size: 15px;
    font-weight: 700;
    color: var(--muted);
}

.payment-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
}

/* Sütun kabının içinde %60 sınırı tutarı kendi genişliğinden dar sıkıştırıyordu (kırpılma) */
.payment-side .row-amount {
    max-width: none;
}

.payment-undo {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    min-width: 44px;
    justify-content: flex-end;
    font-size: 14px;
    font-weight: 600;
    color: var(--out);
    text-decoration: none;
}

.action-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.badge--danger {
    color: #fff;
    background: var(--out);
}

.empty--compact {
    padding: 20px;
}

.label--center {
    display: block;
    text-align: center;
}

.help--below {
    margin: 8px 4px 0;
}

.pay-summary {
    margin-bottom: 8px;
    text-align: center;
}

.pay-installment {
    font-size: 20px;
    font-weight: 700;
}

.closed-debts-list {
    padding: 0 14px 2px;
}

.closed-debts-list .debt-card {
    box-shadow: none;
    border: 1px solid var(--line);
    border-left-width: 4px;
}


/* ─── 11f. Görevler + şirket cari (§C.7) ─────────────────────── */

/* Şirkete borç turuncu (§C.3: "turuncu/kırmızı"); gelen/çıkan renkleri korunur */
.text-warn { color: var(--warn); }
.text-muted { color: var(--muted); }

.ledger-card {
    margin-bottom: 12px;
}

.ledger-title {
    font-size: 16px;
    margin-bottom: 4px;
}

.kv--tight {
    margin-top: 6px;
}

.kv--tight > div {
    padding: 6px 0;
}

.ledger-net {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 16px;
    margin-top: 10px;
    padding: 12px 14px;
    font-size: 16px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    overflow-wrap: anywhere;
}

.ledger-net--in { color: var(--in); }
.ledger-net--out { color: var(--warn); }
.ledger-net--zero { color: var(--muted); }

.mission-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 44px;
    margin-bottom: 12px;
    padding: var(--pad);
    color: inherit;
    text-decoration: none;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--line);
}

a.mission-card:active {
    background: var(--surface-2);
}

.mission-card--in { border-left-color: var(--in); }
.mission-card--out { border-left-color: var(--warn); }

.mission-card.is-closed {
    opacity: .75;
}

.mission-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.mission-title {
    min-width: 0;
    font-size: 17px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.mission-status {
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}

.mission-meta {
    font-size: 14px;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.mission-meta strong {
    color: var(--text);
}

.mission-net {
    font-weight: 700;
    overflow-wrap: anywhere;
}

.mission-detail {
    margin-bottom: 4px;
}

.mission-status-line {
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
}

/* Kalem kalem hesap özeti — geniş tablo kendi kabında kayar (§A) */
.ledger-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    font-size: 15px;
}

.ledger-table th,
.ledger-table td {
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid var(--line);
}

.ledger-table thead th {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}

.ledger-table td:last-child,
.ledger-table th:last-child {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.ledger-table tfoot th,
.ledger-table tfoot td {
    font-size: 17px;
    font-weight: 700;
    border-bottom: 0;
}

.ledger-verdict {
    margin: 8px 4px 0;
    font-weight: 700;
}

.quick-actions--mission {
    grid-template-columns: repeat(2, 1fr);
}

.quick-actions--mission .quick {
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    min-height: 56px;
    padding: 10px 12px;
}

.quick-actions--mission .quick-label {
    font-size: 14px;
    text-align: left;
}

/* Onay ekranında büyük satır bir cümle olabilir ("Şirket sana 4.000 ₺ borçlu") */
.confirm-amount {
    white-space: normal;
    overflow-wrap: anywhere;
}


/* ─── 11g. Ayarlar + tekrarlayan işlemler (§C.9, §6) ─────────── */

/* Form içindeki radyo grupları: tarayıcının fieldset çerçevesi yok */
fieldset.field {
    min-width: 0;
    margin-left: 0;
    margin-right: 0;
    padding: 0;
    border: 0;
}

fieldset.field > .label {
    padding: 0;
}

.settings-row.is-disabled {
    opacity: .45;
}

.row-chevron {
    flex-shrink: 0;
    font-size: 22px;
    line-height: 1;
    color: var(--muted);
}

.badge--count {
    color: #1f1300;
    background: var(--warn);
}

.badge--auto,
.badge--posted {
    color: var(--accent-fg);
    background: var(--focus);
}

.badge--pending {
    color: #1f1300;
    background: var(--warn);
}

.rule-row.is-inactive .row-title,
.rule-row.is-inactive .row-amount {
    color: var(--muted);
}

.run-row .row-title {
    font-weight: 500;
}

/* Onay bekleyenler: özet ekranında kart, kural sayfasında liste */
.pending-card,
.pending-list {
    margin-bottom: 12px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.pending-card {
    border-left: 4px solid var(--warn);
}

.pending-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px var(--pad) 0;
}

.pending-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.pending-run {
    padding: 12px var(--pad);
    border-bottom: 1px solid var(--line);
}

.pending-run:last-child {
    border-bottom: 0;
}

.pending-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pending-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}

.pending-actions .btn {
    min-height: 44px;
}


/* ─── 11h. Bütçeler (§8): yeşil / sarı / kırmızı ─────────────── */

.budget-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.budget-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 44px;
    padding: 12px var(--pad);
    color: inherit;
    text-decoration: none;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    touch-action: manipulation;
}

.budget-card:active {
    background: var(--surface-2);
}

.budget-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.budget-percent {
    flex-shrink: 0;
    font-size: 18px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.budget-foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 12px;
    font-size: 14px;
    color: var(--muted);
}

.budget-state {
    font-weight: 600;
    white-space: nowrap;
}

.budget-card.is-ok .progress-bar { background: var(--in); }
.budget-card.is-warn .progress-bar { background: var(--warn); }
.budget-card.is-over .progress-bar { background: var(--out); }
.budget-card.is-warn .budget-percent,
.budget-card.is-warn .budget-state { color: var(--warn); }
.budget-card.is-over .budget-percent,
.budget-card.is-over .budget-state { color: var(--out); }

.month-nav + .budget-list,
.month-nav + .empty {
    margin-top: 12px;
}


/* ─── 11i. Raporlar + grafikler (§C.8, §7) ───────────────────── */

.month-nav-btn.is-disabled {
    opacity: .35;
    box-shadow: none;
}

.report-card {
    margin-bottom: 12px;
}

.report-lines {
    margin: 0;
}

.report-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.report-line:first-child {
    padding-top: 0;
}

.report-line:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.report-line dt {
    color: var(--muted);
}

.report-line dd {
    margin: 0;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.report-line--total dt {
    color: var(--text);
    font-weight: 700;
}

.report-line--total dd {
    font-size: 20px;
    font-weight: 700;
}

.card--flush {
    padding: 0;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.report-table th,
.report-table td {
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--line);
}

.report-table thead th {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--muted);
}

.report-table tbody th {
    font-weight: 500;
}

.report-table tfoot th,
.report-table tfoot td {
    font-weight: 700;
    border-bottom: 0;
}

.report-table .num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.report-cat {
    display: block;
}

.report-share,
.report-limit {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: var(--muted);
}

.report-budget {
    font-weight: 700;
}

/* Yıllık tablo: aya dokunulan hücre tam satır yüksekliğinde bağlantı */
.report-table--year tbody th {
    padding: 0;
}

.report-table--year tbody th a {
    display: flex;
    align-items: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0 12px;
    font-weight: 600;
    text-decoration: none;
}

/* Dar ekran (iPhone SE): yıllık tablonun 4 sütunu sığsın */
@media (max-width: 360px) {
    .report-table--year {
        font-size: 13px;
    }

    .report-table--year th,
    .report-table--year td {
        padding-left: 6px;
        padding-right: 6px;
    }

    .report-table--year tbody th a {
        padding: 0 6px;
    }
}

.chart-card {
    margin-bottom: 12px;
}

.chart-box {
    position: relative;
    height: 220px;
}

/* Chart.js tuvali kendi ölçüsünü kurana kadar (ilk kare) kabından taşmasın:
   dar ekranda bir anlık yatay kaymaya yol açıyordu. */
.chart-box canvas,
.chart-card canvas {
    max-width: 100%;
}

.chart-box--donut {
    height: 280px;
}

.chart-box--mini {
    height: 160px;
}

.chart-box--error {
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 14px;
}


/* ─── 11j. PWA: "Ana Ekrana Ekle" bandı (§E) ─────────────────── */

.a2hs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;               /* dar ekranda "Yükle" alt satıra insin, taşma olmasın */
    gap: 10px;
    margin-bottom: 12px;
    padding: 8px 4px 8px 14px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--accent);
    box-shadow: var(--shadow);
}

.a2hs[hidden] {
    display: none;
}

.a2hs-icon {
    flex-shrink: 0;
    font-size: 22px;
}

.a2hs-text {
    flex: 1 1 60%;                 /* metin daralabilir; gerekirse düğme alta geçer */
    min-width: 0;
    font-size: 14px;
}

.a2hs-action {
    flex-shrink: 0;
    min-height: 44px;              /* dokunma hedefi (§A) */
    padding: 6px 16px;
    font-size: 14px;
}

.a2hs-action[hidden] {
    display: none;
}

.a2hs-close {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
}

.a2hs-close:active {
    background: var(--surface-2);
}


/* ─── 11k. SVG ikonlar (Lucide sprite — App\\Core\\Icon) ───────────
   Boyut kabın yazı boyutundan (1em), renk yazı renginden (currentColor) gelir:
   eski emoji kapları (row-icon, tab-icon, quick-icon…) değişmeden çalışır. */

.icon {
    display: inline-block;
    flex-shrink: 0;
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    overflow: visible;
}

.row-icon .icon,
.debt-icon .icon {
    width: 22px;
    height: 22px;
}

.row-icon {
    color: var(--muted);
}

.tab-icon .icon {
    width: 24px;
    height: 24px;
    stroke-width: 1.8;
}

.tab-plus .icon {
    width: 28px;
    height: 28px;
    stroke-width: 2.4;
}

.quick-icon .icon {
    width: 20px;
    height: 20px;
}

.quick--in .quick-icon .icon,
.quick--out .quick-icon .icon {
    stroke-width: 2.8;
}

.flash-icon .icon {
    width: 14px;
    height: 14px;
    stroke-width: 3;
}

.empty-icon .icon {
    width: 40px;
    height: 40px;
    stroke-width: 1.5;
    color: var(--muted);
}

.alert-icon .icon {
    width: 22px;
    height: 22px;
}

.alert--warn .alert-icon { color: var(--warn); }
.alert--danger .alert-icon { color: var(--out); }
.alert--info .alert-icon { color: var(--accent-fg); }

.month-nav-btn .icon,
.row-chevron .icon {
    width: 22px;
    height: 22px;
}

.chip-icon .icon {
    width: 18px;
    height: 18px;
}

.pin-lock-icon .icon {
    width: 28px;
    height: 28px;
}

.topbar-icon-btn .icon {
    width: 22px;
    height: 22px;
}

.btn .icon {
    width: 20px;
    height: 20px;
    margin-right: 4px;
}

.section-title .icon {
    width: 16px;
    height: 16px;
    margin-right: 2px;
}

.balance-debt-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.a2hs-icon {
    color: var(--accent-fg);
}

.icon--inline {
    width: 16px;
    height: 16px;
}

/* Görev durumu: renkli nokta (yeşil = açık) */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 6px;
    vertical-align: 1px;
    border-radius: 50%;
    background: var(--line);
    box-shadow: inset 0 0 0 1px var(--muted);
}

.status-dot.is-open {
    background: var(--in);
    box-shadow: none;
}


/* ─── 11b. Ayarlar alt sayfaları ─────────────────────────────── */

/* Onay kutusu — dokunma hedefi 44px (§A) */
.check {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.check-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.check-box {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    color: transparent;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.check-input:checked + .check-box {
    color: var(--accent-text);
    background: var(--accent);
    border-color: var(--accent);
}

.check-input:focus-visible + .check-box {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.check-text {
    font-size: 16px;
}

.field.has-error .check-box {
    border-color: var(--out);
}

/* Seçenek listesi (tema, şirket cari modu) */
.choices {
    display: grid;
    gap: 8px;
}

.choice-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.choice {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 60px;
    padding: 12px 14px;
    background: var(--surface-2);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    touch-action: manipulation;
}

.choice-icon {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    color: var(--muted);
    background: var(--surface);
    border-radius: var(--radius-sm);
    font-size: 20px;
}

.choice-main {
    flex: 1;
    min-width: 0;
}

.choice-title {
    display: block;
    font-weight: 600;
}

.choice-sub {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
}

.choice-mark {
    flex-shrink: 0;
    color: transparent;
    font-size: 20px;
}

.choice-input:checked + .choice {
    background: var(--surface);
    border-color: var(--accent);
}

.choice-input:checked + .choice .choice-icon,
.choice-input:checked + .choice .choice-mark {
    color: var(--accent-fg);
}

.choice-input:focus-visible + .choice {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Kategori listesi: satır + sıra okları (sürükleme yok — dokunmayla çalışır) */
.cat-row {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--line);
}

.cat-row:last-child {
    border-bottom: 0;
}

.cat-main {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 12px;
    min-width: 0;
    min-height: 56px;
    padding: 10px 4px 10px var(--pad);
    color: inherit;
    text-decoration: none;
    touch-action: manipulation;
}

.cat-main:active {
    background: var(--surface-2);
}

.cat-row.is-inactive .row-title,
.cat-row.is-inactive .row-icon {
    color: var(--muted);
}

/* Sıralama tutamağı — JS açıksa görünür (görünümde hidden gelir) */
.cat-drag {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 40px;
    align-self: stretch;
    color: var(--muted);
    font-size: 20px;
    cursor: grab;
    touch-action: none;            /* iOS: sayfa kaymasın, satır sürüklensin */
    -webkit-user-select: none;
    user-select: none;
}

.cat-drag[hidden] {
    display: none;
}

.cat-row.is-dragging {
    position: relative;
    z-index: 2;
    background: var(--surface);
    box-shadow: 0 8px 20px rgba(15, 23, 42, .18);
    border-radius: var(--radius-sm);
    cursor: grabbing;
}

.cat-list.is-reordering .cat-main {
    pointer-events: none;          /* sürüklerken bağlantıya gidilmesin */
}

.cat-order {
    display: flex;
    flex-shrink: 0;
    padding-right: 6px;
}

.order-btn {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    color: var(--muted);
    background: none;
    border: 0;
    border-radius: var(--radius-sm);
    font-size: 20px;
    cursor: pointer;
    touch-action: manipulation;
}

.order-btn:active {
    background: var(--surface-2);
}

.order-btn:disabled {
    opacity: .25;
    cursor: default;
}

/* İkon seçici — kendi kabında dikey kayar, sayfa kaymaz */
.icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    gap: 6px;
    max-height: 228px;
    padding: 6px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
}

.icon-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.icon-pick {
    display: grid;
    place-items: center;
    height: 48px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 20px;
    cursor: pointer;
    touch-action: manipulation;
}

.icon-input:checked + .icon-pick {
    color: var(--accent-text);
    background: var(--accent);
    border-color: var(--accent);
}

.icon-input:focus-visible + .icon-pick {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Renk seçici */
.swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.swatch-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.swatch {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    background: var(--swatch, var(--surface-2));
    border: 2px solid transparent;
    border-radius: 999px;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .12);
    cursor: pointer;
    touch-action: manipulation;
}

.swatch--none {
    color: var(--muted);
    font-size: 18px;
}

.swatch-input:checked + .swatch {
    border-color: var(--text);
}

.swatch-input:focus-visible + .swatch {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Bütünlük kontrolü listesi (Hakkında) */
.check-row {
    align-items: flex-start;
}

.check-row .row-icon {
    background: none;
}

.check-row.is-ok .row-icon {
    color: var(--in);
}

.check-row.is-fail .row-icon {
    color: var(--warn);
}

.check-row .row-sub-text {
    line-height: 1.4;
}


/* Giriş ekranı tanıtım kartı — örnek grafik (gerçek veri değil) */
.login-preview {
    margin: 4px 0 20px;
    padding: 16px 16px 14px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.login-preview-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.login-preview-title {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    font-weight: 600;
}

.login-preview-badge {
    flex-shrink: 0;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--surface-2);
    border-radius: 999px;
}

.login-chart {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.login-chart-bar--in { fill: var(--in); }
.login-chart-bar--out { fill: var(--out); }

.login-chart-label {
    fill: var(--muted);
    font-size: 9px;
    font-family: var(--font);
}

.login-preview-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--muted);
}

.login-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.login-dot--in { background: var(--in); }
.login-dot--out { background: var(--out); margin-left: 8px; }

.login-preview-text {
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--muted);
}


/* Madde ve adım listeleri (Ayarlar > Uygulamayı Yükle) */
.bullet-list,
.step-list {
    margin: 0 0 4px;
    padding-left: 22px;
    font-size: 15px;
    line-height: 1.5;
}

.bullet-list li,
.step-list li {
    margin-bottom: 8px;
}

.step-list li::marker {
    font-weight: 700;
    color: var(--accent-fg);
}


/* ─── 12. Yardımcılar ────────────────────────────────────────── */

.muted { color: var(--muted); }
.text-in { color: var(--in); }
.text-out { color: var(--out); }
.stack-top { margin-top: 24px; }

.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;
}


/* ─── 13. Hareket azaltma ────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}
