/* =====================================================================
   EV MUHASEBE  -  Stil Dosyası
   Estetik: sıcak editöryel fintech — krem zemin, orman yeşili vurgu
   ===================================================================== */

:root {
    /* Renk paleti */
    --cream:        #F6F4EE;
    --cream-2:      #EFEBE0;
    --paper:        #FFFFFF;
    --ink:          #1C1F26;
    --ink-soft:     #4A4F5A;
    --ink-faint:    #8A8F99;
    --line:         #E4DFD2;
    --line-soft:    #EDE9DE;

    --forest:       #14452F;   /* ana vurgu */
    --forest-700:   #0F3A27;
    --forest-300:   #2E6B4C;
    --gold:         #B98A2E;    /* ikincil vurgu */
    --gold-soft:    #F2E7CC;

    --income:       #15803D;
    --income-bg:    #E7F3EB;
    --expense:      #C2410C;
    --expense-bg:   #FBEAE1;
    --danger:       #B91C1C;
    --info:         #0E7490;

    /* Tipografi */
    --font-display: 'Bricolage Grotesque', Georgia, serif;
    --font-body:    'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;

    /* Şekil */
    --radius:       16px;
    --radius-sm:    10px;
    --radius-lg:    24px;
    --shadow:       0 1px 2px rgba(28,31,38,.04), 0 8px 24px rgba(28,31,38,.06);
    --shadow-lg:    0 12px 40px rgba(20,69,47,.12);

    --sidebar-w:    264px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background:
        radial-gradient(1200px 600px at 100% -10%, rgba(185,138,46,.07), transparent 60%),
        radial-gradient(900px 500px at -10% 110%, rgba(20,69,47,.06), transparent 55%),
        var(--cream);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a { color: var(--forest-300); text-decoration: none; }
a:hover { color: var(--forest); }

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--ink);
    margin: 0 0 .4em;
}

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

/* ---------------------------------------------------------------------
   GİRİŞ / KAYIT EKRANLARI
   --------------------------------------------------------------------- */
.auth-wrap {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr .95fr;
}
.auth-brand {
    background:
        radial-gradient(700px 400px at 20% 10%, rgba(185,138,46,.22), transparent 60%),
        linear-gradient(155deg, var(--forest) 0%, var(--forest-700) 100%);
    color: #F3EFE4;
    padding: 56px 56px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}
.auth-brand::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(0deg, rgba(255,255,255,.04) 0 1px, transparent 1px 26px),
        repeating-linear-gradient(90deg, rgba(255,255,255,.04) 0 1px, transparent 1px 26px);
    pointer-events: none;
}
.auth-brand .logo {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 26px;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}
.auth-brand .logo .mark {
    width: 40px; height: 40px;
    background: var(--gold);
    color: var(--forest-700);
    border-radius: 12px;
    display: grid; place-items: center;
    font-size: 22px;
}
.auth-brand .pitch { position: relative; max-width: 420px; }
.auth-brand .pitch h2 {
    color: #fff;
    font-size: clamp(28px, 3.4vw, 44px);
    line-height: 1.08;
    margin-bottom: 16px;
}
.auth-brand .pitch p { color: rgba(243,239,228,.82); font-size: 16px; }
.auth-brand .features { position: relative; display: grid; gap: 12px; margin-top: 10px; }
.auth-brand .features li {
    list-style: none;
    display: flex; gap: 10px; align-items: flex-start;
    color: rgba(243,239,228,.9); font-size: 14.5px;
}
.auth-brand .features .dot { color: var(--gold); font-weight: 700; }
.auth-foot { position: relative; color: rgba(243,239,228,.6); font-size: 13px; }

.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}
.auth-card {
    width: 100%;
    max-width: 400px;
}
.auth-card h1 { font-size: 28px; }
.auth-card .sub { color: var(--ink-soft); margin-bottom: 28px; }
.auth-switch { margin-top: 22px; font-size: 14px; color: var(--ink-soft); text-align: center; }

@media (max-width: 880px) {
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
}

/* ---------------------------------------------------------------------
   UYGULAMA İSKELETİ (Sidebar + İçerik)
   --------------------------------------------------------------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--forest);
    color: #E9E4D6;
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
}
/* Üst (marka, ev seçici) ve alt (kullanıcı) bloklar sabit; yalnızca .nav kayar */
.sidebar .brand,
.sidebar .house-switch,
.sidebar .me { flex-shrink: 0; }
.sidebar .brand {
    display: flex; align-items: center; gap: 10px;
    font-family: var(--font-display); font-weight: 700; font-size: 19px;
    color: #fff; padding: 4px 8px 18px;
}
.sidebar .brand .mark {
    width: 34px; height: 34px; background: var(--gold); color: var(--forest-700);
    border-radius: 10px; display: grid; place-items: center; font-size: 18px;
}

/* Ev seçici */
.house-switch { padding: 0 4px 16px; }
.house-switch label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: rgba(233,228,214,.55); }
.house-switch select {
    width: 100%; margin-top: 6px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.14);
    color: #fff; border-radius: 10px; padding: 9px 10px; font-size: 14px;
    font-family: var(--font-body);
}
.house-switch select option { color: #1c1f26; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.28) transparent; -webkit-overflow-scrolling: touch; }
.nav::-webkit-scrollbar { width: 7px; }
.nav::-webkit-scrollbar-track { background: transparent; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.20); border-radius: 99px; }
.nav:hover::-webkit-scrollbar-thumb { background: rgba(255,255,255,.34); }
.nav a {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 12px; border-radius: 11px;
    color: rgba(233,228,214,.82); font-weight: 500; font-size: 14.5px;
    transition: background .15s, color .15s;
}
.nav a .ic { width: 20px; text-align: center; font-size: 16px; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.active { background: rgba(255,255,255,.13); color: #fff; }
.nav .sep { height: 1px; background: rgba(255,255,255,.1); margin: 10px 8px; }

.sidebar .me {
    border-top: 1px solid rgba(255,255,255,.1);
    padding-top: 14px; margin-top: 8px;
    display: flex; align-items: center; gap: 10px;
}
.sidebar .me .av {
    width: 36px; height: 36px; border-radius: 50%;
    display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px;
    flex-shrink: 0;
}
.sidebar .me .info { line-height: 1.2; min-width: 0; }
.sidebar .me .info b { color: #fff; font-size: 14px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .me .info span { color: rgba(233,228,214,.55); font-size: 12px; }
.sidebar .me a.logout { margin-left: auto; color: rgba(233,228,214,.6); font-size: 13px; }
.sidebar .me a.logout:hover { color: #fff; }

.main { flex: 1; min-width: 0; padding: 28px 34px 56px; }

.topbar {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.topbar .page-title h1 { font-size: 26px; margin-bottom: 2px; }
.topbar .page-title p { color: var(--ink-soft); margin: 0; font-size: 14px; }
.topbar .actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Mobil menü düğmesi */
.menu-toggle { display: none; }

@media (max-width: 920px) {
    .sidebar {
        position: fixed; z-index: 60; left: 0; top: 0;
        height: 100vh; height: 100dvh; overflow-y: auto;
        transform: translateX(-100%); transition: transform .25s ease;
        box-shadow: var(--shadow-lg);
    }
    body.nav-open .sidebar { transform: translateX(0); }
    .main { padding: 18px 16px 48px; }
    /* Mobilde daraltma düğmesi gizli; menü hamburger ile açılır */
    .nav-collapse-btn { display: none !important; }
    .menu-toggle {
        display: inline-grid; place-items: center;
        width: 42px; height: 42px; border-radius: 11px;
        background: var(--paper); border: 1px solid var(--line);
        font-size: 19px; cursor: pointer;
    }
    .scrim { display: none; position: fixed; inset: 0; background: rgba(20,30,25,.45); z-index: 55; }
    body.nav-open .scrim { display: block; }
}

/* ---------------------------------------------------------------------
   KENAR ÇUBUĞU DARALTMA (açılır / kapanır) — yalnızca masaüstü
   --------------------------------------------------------------------- */
.brand { justify-content: space-between; }
.brand .brand-label { display: inline-flex; align-items: center; gap: 10px; min-width: 0; overflow: hidden; }
.nav-collapse-btn { display: none; }

@media (min-width: 921px) {
    .sidebar { transition: width .2s ease, padding .2s ease; }
    .nav-collapse-btn {
        display: inline-grid; place-items: center; flex-shrink: 0;
        width: 30px; height: 30px; border-radius: 9px; cursor: pointer;
        background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16);
        color: #fff; font-size: 16px; line-height: 1; transition: background .15s, transform .2s;
    }
    .nav-collapse-btn:hover { background: rgba(255,255,255,.18); }

    body.nav-collapsed .sidebar { width: 76px; padding-left: 12px; padding-right: 12px; }
    body.nav-collapsed .brand { justify-content: center; }
    body.nav-collapsed .brand .brand-label { display: none; }
    body.nav-collapsed .nav-collapse-btn { transform: rotate(180deg); }
    body.nav-collapsed .house-switch { display: none; }
    body.nav-collapsed .nav a { justify-content: center; padding: 11px 0; }
    body.nav-collapsed .nav a .label { display: none; }
    body.nav-collapsed .nav a .ic { width: auto; font-size: 18px; }
    body.nav-collapsed .nav .sep { margin: 10px 6px; }
    body.nav-collapsed .me { justify-content: center; }
    body.nav-collapsed .me .info,
    body.nav-collapsed .me a.logout { display: none; }
}

/* ---------------------------------------------------------------------
   KARTLAR
   --------------------------------------------------------------------- */
.card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-pad { padding: 22px; }
.card h3 { font-size: 16px; }
.card-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px; border-bottom: 1px solid var(--line-soft);
}
.card-head h3 { margin: 0; }

.grid { display: grid; gap: 18px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.cols-2-1 { grid-template-columns: 2fr 1fr; }
@media (max-width: 1040px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .cols-2-1 { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* Özet istatistik kartları */
.stat {
    position: relative;
    padding: 20px 22px;
    overflow: hidden;
}
.stat .label { font-size: 13px; color: var(--ink-soft); display: flex; align-items: center; gap: 8px; }
.stat .label .chip {
    width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 15px;
}
.stat .value {
    font-family: var(--font-display);
    font-size: 28px; font-weight: 700; margin-top: 12px;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.stat .meta { font-size: 12.5px; color: var(--ink-faint); margin-top: 4px; }
.stat.income .value { color: var(--income); }
.stat.expense .value { color: var(--expense); }
.stat.balance .value { color: var(--forest); }

/* ---------------------------------------------------------------------
   DÜĞMELER
   --------------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: var(--font-body); font-weight: 600; font-size: 14px;
    padding: 10px 16px; border-radius: 11px;
    border: 1px solid transparent; cursor: pointer;
    transition: transform .08s, background .15s, box-shadow .15s;
    text-decoration: none; line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--forest); color: #fff; }
.btn-primary:hover { background: var(--forest-700); color: #fff; box-shadow: var(--shadow-lg); }
.btn-gold { background: var(--gold); color: var(--forest-700); }
.btn-gold:hover { background: #a87b25; color: #fff; }
.btn-ghost { background: var(--paper); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--cream-2); }
.btn-danger { background: var(--expense-bg); color: var(--danger); border-color: #f0cdbb; }
.btn-danger:hover { background: #f7dccd; }
.btn-sm { padding: 7px 11px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------------------------------------------------------------------
   FORMLAR
   --------------------------------------------------------------------- */
.field { margin-bottom: 16px; }
.field label {
    display: block; font-size: 13px; font-weight: 600;
    color: var(--ink-soft); margin-bottom: 6px;
}
.field .hint { font-size: 12px; color: var(--ink-faint); font-weight: 400; }
.input, select.input, textarea.input {
    width: 100%; padding: 11px 13px;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--paper); color: var(--ink);
    font-family: var(--font-body); font-size: 14.5px;
    transition: border .15s, box-shadow .15s;
}
.input:focus, select.input:focus, textarea.input:focus {
    outline: none; border-color: var(--forest-300);
    box-shadow: 0 0 0 3px rgba(46,107,76,.14);
}
textarea.input { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .form-row, .form-row-3 { grid-template-columns: 1fr; } }

/* Tip seçici (gelir/gider) */
.seg { display: inline-flex; background: var(--cream-2); border-radius: 11px; padding: 4px; gap: 4px; }
.seg label {
    cursor: pointer; padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 600;
    color: var(--ink-soft); margin: 0;
}
.seg input { display: none; }
.seg input:checked + span { }
.seg label.on-income.checked { background: var(--income); color: #fff; }
.seg label.on-expense.checked { background: var(--expense); color: #fff; }

/* ---------------------------------------------------------------------
   TABLOLAR
   --------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
    text-align: left; font-size: 11.5px; text-transform: uppercase;
    letter-spacing: .06em; color: var(--ink-faint); font-weight: 700;
    padding: 12px 16px; border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
table.data td {
    padding: 13px 16px; border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
}
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--cream); }
.amount { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.amount.income { color: var(--income); }
.amount.expense { color: var(--expense); }
.num-right { text-align: right; }

/* Kategori rozeti */
.cat-badge {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 13px; font-weight: 600;
    padding: 4px 10px 4px 4px; border-radius: 999px;
    background: var(--cream-2);
}
.cat-badge .swatch { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; }

.pill {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
}
.pill.income { background: var(--income-bg); color: var(--income); }
.pill.expense { background: var(--expense-bg); color: var(--expense); }
.pill.gray { background: var(--cream-2); color: var(--ink-soft); }
.pill.owner { background: var(--gold-soft); color: #8a6516; }
.pill.import { background: #E7EEF4; color: var(--info); }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.icon-btn {
    width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line);
    background: var(--paper); cursor: pointer; display: grid; place-items: center;
    font-size: 14px; color: var(--ink-soft); transition: background .15s;
}
.icon-btn:hover { background: var(--cream-2); color: var(--ink); }
.icon-btn.danger:hover { background: var(--expense-bg); color: var(--danger); border-color: #f0cdbb; }

/* Boş durum */
.empty {
    text-align: center; padding: 48px 24px; color: var(--ink-faint);
}
.empty .big { font-size: 38px; margin-bottom: 10px; }
.empty h3 { color: var(--ink-soft); }

/* ---------------------------------------------------------------------
   FLASH MESAJLARI
   --------------------------------------------------------------------- */
.flashes { margin-bottom: 18px; display: grid; gap: 10px; }
.flash {
    padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 500;
    display: flex; align-items: center; gap: 10px;
    border: 1px solid;
}
.flash.success { background: var(--income-bg); border-color: #bfe0c9; color: #14532d; }
.flash.error   { background: var(--expense-bg); border-color: #f0cdbb; color: #7c2d12; }
.flash.info    { background: #E7EEF4; border-color: #c5dae6; color: #0c4a6e; }

/* ---------------------------------------------------------------------
   MODAL
   --------------------------------------------------------------------- */
.modal-overlay {
    display: none; position: fixed; inset: 0; z-index: 100;
    background: rgba(20,30,25,.5);
    align-items: flex-start; justify-content: center;
    padding: 40px 16px; overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--paper); border-radius: var(--radius-lg);
    width: 100%; max-width: 540px; box-shadow: var(--shadow-lg);
    animation: pop .18s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { padding: 20px 24px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; }
.modal-head .x { cursor: pointer; font-size: 22px; color: var(--ink-faint); line-height: 1; background: none; border: none; }
.modal-body { padding: 24px; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--line-soft); display: flex; gap: 10px; justify-content: flex-end; }

/* ---------------------------------------------------------------------
   ÇEŞİTLİ
   --------------------------------------------------------------------- */
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); font-weight: 700; margin: 28px 0 14px; }
.muted { color: var(--ink-faint); }
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 18px; }
.flex { display: flex; gap: 12px; align-items: center; }
.flex-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }

/* Bütçe ilerleme çubuğu */
.bar { height: 8px; background: var(--cream-2); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--forest-300); }
.bar > span.over { background: var(--expense); }

/* Filtre çubuğu */
.filterbar {
    display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 14px 16px; margin-bottom: 18px;
}
.filterbar .field { margin-bottom: 0; }
.filterbar .field label { margin-bottom: 4px; }
.filterbar .input { min-width: 150px; }

/* Yükleme alanı (drag & drop görünümlü) */
.dropzone {
    border: 2px dashed var(--line); border-radius: var(--radius);
    background: var(--cream); padding: 36px 24px; text-align: center;
    transition: border .15s, background .15s;
}
.dropzone:hover { border-color: var(--forest-300); background: #fff; }
.dropzone .big { font-size: 40px; }
.dropzone input[type=file] { margin-top: 14px; }

/* Liste (etkinlik, üyeler) */
.list { display: flex; flex-direction: column; }
.list .item { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
.list .item:last-child { border-bottom: none; }
.list .item .av { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; flex-shrink: 0; }
.list .item .grow { flex: 1; min-width: 0; }
.list .item .grow b { display: block; }
.list .item .grow span { font-size: 13px; color: var(--ink-faint); }

.code-box {
    font-family: 'Bricolage Grotesque', monospace; font-size: 24px; font-weight: 700;
    letter-spacing: .12em; background: var(--gold-soft); color: #8a6516;
    padding: 10px 18px; border-radius: 12px; display: inline-block;
}

/* =====================================================================
   v2 BİLEŞENLERİ + TEMALAR
   ===================================================================== */

/* ---- Yardımcılar ---- */
.stack { display: flex; flex-direction: column; gap: 18px; }
.r { text-align: right; }
table.data th.r, table.data td.r { text-align: right; }
table.data tfoot td { padding: 10px 14px; border-top: 2px solid var(--line); font-size: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; font-size: 13.5px; color: var(--ink-soft); cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--forest); flex: none; }
.check span b { color: var(--ink); }
.kv { display: flex; flex-direction: column; margin: 6px 0 4px; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; padding: 7px 0; border-bottom: 1px dashed var(--line-soft); }
.kv > div:last-child { border-bottom: none; }
.kv > div span { color: var(--ink-soft); }
code { background: var(--cream-2); padding: 1px 6px; border-radius: 6px; font-size: 12.5px; }

/* ---- İçgörü kartları (raporlar) ---- */
.insight { display: flex; gap: 12px; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--line-soft); margin-bottom: 10px; background: var(--paper); }
.insight .ic { font-size: 20px; line-height: 1; flex: none; }
.insight b { display: block; margin-bottom: 2px; font-size: 14px; }
.insight p { margin: 0; font-size: 13px; color: var(--ink-soft); }
.insight.warn { border-color: #f0cdbb; background: var(--expense-bg); }
.insight.warn b { color: var(--expense); }
.insight.good { border-color: #bfe3cc; background: var(--income-bg); }
.insight.good b { color: var(--income); }
.insight.tip { border-color: var(--gold); background: var(--gold-soft); }
.insight.info { background: var(--cream-2); }

/* ---- Takvim ---- */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-head { margin-bottom: 6px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 700; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em; }
.cal-cell { min-height: 86px; border: 1px solid var(--line-soft); border-radius: 10px; padding: 6px; background: var(--paper); cursor: pointer; transition: .15s; overflow: hidden; }
.cal-cell:hover { border-color: var(--forest-300); box-shadow: var(--shadow); }
.cal-cell.empty { background: transparent; border: none; cursor: default; }
.cal-cell.today { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft); }
.cal-num { font-size: 12px; font-weight: 700; color: var(--ink-soft); margin-bottom: 4px; }
.cal-ev { font-size: 10.5px; padding: 2px 5px; border-radius: 6px; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; font-weight: 600; }
.cal-ev.expense { background: var(--expense-bg); color: var(--expense); }
.cal-ev.income { background: var(--income-bg); color: var(--income); }
.cal-ev.paid { opacity: .5; text-decoration: line-through; }

/* ---- Birikim hedefleri ---- */
.goal-icon { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex: none; }
.goal-prog { height: 10px; background: var(--cream-2); border-radius: 99px; overflow: hidden; margin-top: 14px; }
.goal-prog-bar { height: 100%; border-radius: 99px; transition: width .6s ease; min-width: 2px; }
.goal-hist { border-top: 1px solid var(--line-soft); margin-top: 12px; }

/* ---- Tema seçici ---- */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 8px; }
.theme-swatch { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 10px; border: 2px solid var(--line); border-radius: 12px; background: var(--paper); cursor: pointer; position: relative; text-align: left; }
.theme-swatch:hover { border-color: var(--forest-300); }
.theme-swatch.active { border-color: var(--forest); box-shadow: 0 0 0 3px var(--gold-soft); }
.theme-swatch .sw { width: 100%; height: 24px; border-radius: 7px; display: block; border: 1px solid rgba(0,0,0,.06); }
.theme-swatch .sw2 { position: absolute; top: 15px; right: 15px; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--paper); }
.theme-swatch .tn { font-size: 12.5px; font-weight: 600; color: var(--ink); }

/* ---- Açılır hesap makinesi ---- */
.calc-fab { position: fixed; right: 22px; bottom: 22px; width: 54px; height: 54px; border-radius: 50%; border: none; background: var(--forest); color: #fff; font-size: 22px; cursor: pointer; box-shadow: var(--shadow-lg); z-index: 60; transition: .15s; }
.calc-fab:hover { background: var(--forest-700); transform: translateY(-2px); }
.calc-pop { position: fixed; right: 22px; bottom: 86px; width: 284px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); z-index: 61; padding: 14px; display: none; }
.calc-pop.open { display: block; animation: calcIn .15s ease; }
@keyframes calcIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.calc-bar { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 13px; color: var(--ink-soft); margin-bottom: 8px; }
.calc-x { border: none; background: none; font-size: 20px; cursor: pointer; color: var(--ink-faint); line-height: 1; }
.calc-expr { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; text-align: right; font-size: 14px; background: var(--cream); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.calc-res { text-align: right; font-size: 24px; font-weight: 800; color: var(--ink); padding: 6px 2px 10px; font-variant-numeric: tabular-nums; min-height: 30px; word-break: break-all; font-family: var(--font-display); }
.calc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ck { border: 1px solid var(--line); background: var(--paper); border-radius: 10px; padding: 12px 0; font-size: 16px; cursor: pointer; color: var(--ink); font-variant-numeric: tabular-nums; transition: .1s; }
.ck:hover { background: var(--cream-2); }
.ck:active { transform: translateY(1px); }
.ck.op { background: var(--cream-2); color: var(--forest); font-weight: 700; }
.ck.fn { background: var(--cream-2); color: var(--ink-soft); font-size: 14px; }
.ck.eq { background: var(--forest); color: #fff; font-weight: 700; }
.ck.eq:hover { background: var(--forest-700); }
.calc-foot { margin-top: 8px; }
.tiny-toast { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(10px); background: var(--ink); color: var(--paper); padding: 8px 15px; border-radius: 99px; font-size: 13px; opacity: 0; pointer-events: none; transition: .2s; z-index: 70; box-shadow: var(--shadow-lg); }
.tiny-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 640px) {
    .cal-cell { min-height: 62px; padding: 4px; }
    .cal-ev { font-size: 9.5px; }
    .calc-pop { right: 12px; left: 12px; width: auto; }
}

/* =====================================================================
   TEMA VARYANTLARI  (data-theme)
   :root = "standart". Diğerleri yalnızca renk değişkenlerini ezer.
   ===================================================================== */

/* Koyu (Dark) */
[data-theme="koyu"] {
    --cream:#15181E; --cream-2:#1F242C; --paper:#1B2027; --ink:#ECEEF2;
    --ink-soft:#AEB6C1; --ink-faint:#79828F; --line:#2A313B; --line-soft:#242B34;
    --forest:#1C5E3F; --forest-700:#164A31; --forest-300:#3DD68C;
    --gold:#D9A93A; --gold-soft:#33301F;
    --income:#34D399; --income-bg:#15301F; --expense:#FB7B53; --expense-bg:#341B12;
    --danger:#F87171;
    --shadow:0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.45);
    --shadow-lg:0 14px 44px rgba(0,0,0,.55);
}
/* Mor Gece */
[data-theme="mor"] {
    --cream:#1A1330; --cream-2:#241A40; --paper:#201838; --ink:#EFEAFB;
    --ink-soft:#B8ACD8; --ink-faint:#8378A6; --line:#342A52; --line-soft:#2A2145;
    --forest:#6D45C9; --forest-700:#5836A8; --forest-300:#B98AF0;
    --gold:#E0B64A; --gold-soft:#332B16;
    --income:#46DBA0; --income-bg:#1A3A2C; --expense:#FF8A6B; --expense-bg:#3A2236;
    --danger:#F87171;
    --shadow:0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.45);
    --shadow-lg:0 14px 44px rgba(0,0,0,.55);
}
/* Orman Gecesi */
[data-theme="orman-gece"] {
    --cream:#0F1A14; --cream-2:#16271D; --paper:#13211A; --ink:#E6F2EA;
    --ink-soft:#A2C2B0; --ink-faint:#6E8C7B; --line:#22372B; --line-soft:#1C2E24;
    --forest:#1F7A4D; --forest-700:#19623E; --forest-300:#5BD08A;
    --gold:#CB9A3A; --gold-soft:#2A2917;
    --income:#48D08A; --income-bg:#15301F; --expense:#F0875A; --expense-bg:#2F2016;
    --danger:#F87171;
    --shadow:0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.45);
    --shadow-lg:0 14px 44px rgba(0,0,0,.5);
}
/* Pembe */
[data-theme="pembe"] {
    --cream:#FFF1F6; --cream-2:#FCE0EA; --paper:#FFFFFF; --ink:#3A1020;
    --ink-soft:#7C4358; --ink-faint:#B07E90; --line:#F4D2DF; --line-soft:#FAE3EC;
    --forest:#D6336C; --forest-700:#B02556; --forest-300:#E06A93;
    --gold:#C77D0E; --gold-soft:#FBE9CC;
    --income:#15803D; --income-bg:#E7F3EB; --expense:#C2410C; --expense-bg:#FBEAE1;
}
/* Okyanus */
[data-theme="okyanus"] {
    --cream:#EEF6FB; --cream-2:#DCEBF6; --paper:#FFFFFF; --ink:#0E2433;
    --ink-soft:#46647A; --ink-faint:#7C97AB; --line:#CFE2EF; --line-soft:#E1EEF6;
    --forest:#0B6FB8; --forest-700:#085A95; --forest-300:#3E97D1;
    --gold:#C8851E; --gold-soft:#F6E8C9;
    --income:#0E7A52; --income-bg:#E0F2EA; --expense:#C2410C; --expense-bg:#FBEAE1;
}
/* Kahve */
[data-theme="kahve"] {
    --cream:#F3EDE6; --cream-2:#E7DCCD; --paper:#FFFDFA; --ink:#2C1D10;
    --ink-soft:#6B5238; --ink-faint:#9B8369; --line:#E0D2BE; --line-soft:#ECE3D6;
    --forest:#7B4B27; --forest-700:#633C1E; --forest-300:#A06A3E;
    --gold:#B6862F; --gold-soft:#F0E5CC;
    --income:#15803D; --income-bg:#E7F3EB; --expense:#B23A0C; --expense-bg:#F8E6DC;
}

/* =====================================================================
   v3:  Captcha, Destek, Sohbet/Mesajlaşma, Fiyat paylaşımı
   ===================================================================== */
.mb-1 { margin-bottom: 8px; }
.badge { background: var(--expense); color: #fff; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 99px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }

/* Captcha */
.captcha-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.captcha-img { border: 1px solid var(--line); border-radius: 8px; height: 52px; }

/* Destek talebi konuşması */
.chat-thread { display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 10px; }
.msg-av { width: 34px; height: 34px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex: none; }
.msg-body { flex: 1; min-width: 0; }
.msg-meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin-bottom: 3px; color: var(--ink-faint); }
.msg-meta b { color: var(--ink); }
.msg-text { background: var(--cream-2); border-radius: 12px; padding: 10px 13px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.msg-admin .msg-text { background: var(--gold-soft); }

/* Sohbet / mesaj akışı */
.chat-feed { height: 440px; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: var(--cream); }
.chat-compose { border-top: 1px solid var(--line-soft); padding: 14px; background: var(--paper); }
.cmsg { display: flex; gap: 9px; max-width: 80%; }
.cmsg.mine { flex-direction: row-reverse; margin-left: auto; }
.cmsg-av { width: 30px; height: 30px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: none; }
.cmsg.mine .cmsg-av { display: none; }
.cmsg-body { min-width: 0; }
.cmsg-meta { font-size: 11.5px; color: var(--ink-faint); margin-bottom: 2px; }
.cmsg-meta b { color: var(--ink-soft); }
.cmsg-text { background: var(--paper); border: 1px solid var(--line-soft); border-radius: 13px; padding: 8px 12px; font-size: 14px; line-height: 1.45; word-wrap: break-word; }
.cmsg.mine .cmsg-text { background: var(--forest); color: #fff; border-color: var(--forest); }
.cmsg.mine .cmsg-meta { text-align: right; }

/* Fiyat paylaşım kartı */
.price-card { background: var(--gold-soft); border: 1px solid var(--gold); border-radius: 13px; padding: 10px 13px; }
.cmsg.mine .price-card { color: var(--ink); }
.pc-top { font-size: 14px; }
.pc-price { color: var(--expense); font-weight: 800; font-variant-numeric: tabular-nums; }
.pc-store { font-size: 12.5px; color: var(--ink-soft); margin-top: 3px; }
.pc-note { font-size: 13px; margin-top: 4px; color: var(--ink-soft); }

/* Mesajlar listesi */
.dm-conv { gap: 10px; align-items: center; border-radius: 10px; padding: 8px; }
.dm-conv:hover { background: var(--cream-2); }
.dm-conv.active { background: var(--cream-2); }

@media (max-width: 760px) {
    .dm-wrap .card { min-height: auto; }
    .chat-feed { height: 360px; }
    .cmsg { max-width: 92%; }
}

/* =====================================================================
   ALIŞVERİŞ LİSTESİ
   ===================================================================== */
.modal.modal-wide { max-width: 720px; }

/* Liste kartları */
.shop-lists { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 16px; }
.shop-list-card { display: block; color: inherit; }
.shop-list-card .card { height: 100%; transition: transform .15s, box-shadow .15s; }
.shop-list-card:hover .card { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.shop-list-card .icon-badge {
    width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
    font-size: 24px; flex-shrink: 0;
}
.shop-prog { height: 8px; background: var(--cream-2); border-radius: 999px; overflow: hidden; margin-top: 14px; }
.shop-prog > i { display: block; height: 100%; border-radius: 999px; background: var(--forest); transition: width .3s; }

/* Ürün satırları */
.shop-section-title { font-size: 13px; font-weight: 700; color: var(--ink-soft); margin: 22px 0 10px; letter-spacing: .01em; }
.shop-items { display: flex; flex-direction: column; gap: 10px; }
.shop-item {
    display: flex; align-items: center; gap: 14px; padding: 11px 14px;
    background: var(--paper); border: 1px solid var(--line); border-radius: 14px; transition: .15s;
}
.shop-item.done { opacity: .6; background: var(--cream); }
.shop-item.done .si-name { text-decoration: line-through; }
.si-thumb { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 26px; flex-shrink: 0; }
.si-body { flex: 1; min-width: 0; }
.si-name { font-weight: 600; }
.si-meta { font-size: 12.5px; color: var(--ink-faint); margin-top: 2px; }
.si-meta .price { color: var(--forest); font-weight: 600; }
.si-check {
    width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line);
    background: var(--paper); cursor: pointer; display: grid; place-items: center;
    font-size: 15px; color: transparent; flex-shrink: 0; transition: .15s; padding: 0;
}
.si-check:hover { border-color: var(--forest-300); }
.shop-item.done .si-check { background: var(--income); border-color: var(--income); color: #fff; }
.si-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* Ürün kataloğu (görsel seçici) */
.cat-search-row { position: sticky; top: 0; background: var(--paper); padding-bottom: 10px; z-index: 2; }
.cat-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; }
.cat-chip {
    font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 999px;
    border: 1px solid var(--line); background: var(--paper); color: var(--ink-soft); cursor: pointer; transition: .12s;
}
.cat-chip:hover { background: var(--cream-2); }
.cat-chip.active { background: var(--forest); color: #fff; border-color: var(--forest); }
.cat-scroll { max-height: 52vh; overflow-y: auto; margin: 4px -6px 0; padding: 0 6px; }
.cat-group-title { font-size: 13px; font-weight: 700; color: var(--ink-soft); margin: 16px 0 10px; display: flex; align-items: center; gap: 8px; }
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.prod-tile {
    display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 12px 6px;
    border: 1px solid var(--line); border-radius: 14px; background: var(--paper); cursor: pointer;
    text-align: center; transition: .12s;
}
.prod-tile:hover { border-color: var(--forest); transform: translateY(-2px); box-shadow: var(--shadow); }
.prod-tile:active { transform: translateY(0); }
.prod-tile .emoji { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 26px; }
.prod-tile .pname { font-size: 12px; line-height: 1.2; color: var(--ink-soft); }
.cat-empty { text-align: center; color: var(--ink-faint); padding: 30px 10px; display: none; }

@media (max-width: 560px) {
    .prod-grid { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
    .prod-tile .emoji { width: 42px; height: 42px; font-size: 23px; }
}

/* =====================================================================
   MOBİL ALT NAVİGASYON  (Bottom Navigation Bar)
   Yalnızca ≤920 px ekranlarda görünür; masaüstü kenar çubuğunu ezmez.
   ===================================================================== */
.mobile-bottom-nav {
    display: none;                  /* masaüstünde gizle */
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 50;
    background: var(--paper);
    border-top: 1px solid var(--line);
    box-shadow: 0 -2px 20px rgba(28,31,38,.08);
    /* iPhone & Android güvenli alan desteği */
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bn-inner {
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    height: 62px;
}

/* Her gezinme öğesi */
.bn-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px 4px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--ink-faint);
    font-family: var(--font-body);
    font-size: 10.5px;
    font-weight: 500;
    text-decoration: none;
    transition: color .15s, transform .1s;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    line-height: 1;
    min-width: 0;
}
.bn-item:active { transform: scale(.91); }

/* İkon sarmalayıcı */
.bn-icon {
    font-size: 21px;
    line-height: 1;
    transition: transform .18s cubic-bezier(.34,1.56,.64,1);
    display: block;
}

/* Etiket */
.bn-label {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    max-width: 60px;
}

/* Aktif öğe */
.bn-item.active {
    color: var(--forest);
}
.bn-item.active .bn-icon {
    transform: translateY(-3px) scale(1.1);
}

/* Aktif gösterge noktası */
.bn-dot {
    position: absolute;
    top: 5px;
    width: 4px; height: 4px;
    border-radius: 50%;
    background: var(--forest);
    opacity: 0;
    transition: opacity .18s;
}
.bn-item.active .bn-dot { opacity: 1; }

/* "Menü" butonu kapandığında aktif görünmemeli */
.bn-item[data-page="more"].nav-open-indicator { color: var(--forest); }

/* ---- Mobilde görünür yap + ana içeriğe alt boşluk ekle ---- */
@media (max-width: 920px) {
    .mobile-bottom-nav { display: block; }

    /* Ana içerik bottom nav yüksekliğinin altına geçmesin */
    .main { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }

    /* Hesap makinesi FAB çakışmasın */
    .calc-fab {
        bottom: calc(76px + env(safe-area-inset-bottom, 0px));
        right: 16px;
    }
    .calc-pop {
        bottom: calc(138px + env(safe-area-inset-bottom, 0px));
        right: 12px;
    }
}

/* PWA yükleme butonu da yukarıya çıksın */
@media (max-width: 920px) {
    #pwaInstallBtn {
        bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
    }
}
