* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    min-height: 100vh;
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px 16px 320px;
}

h1 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: #1a1a2e;
}

/* Toplam */
.total-bar {
    background: #6c63ff;
    color: #fff;
    border-radius: 14px;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 1rem;
}
.total-bar .total-amount {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Liste */
.receipt-list { display: flex; flex-direction: column; gap: 8px; }

.receipt-item {
    background: #fff;
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.receipt-item .info { flex: 1; min-width: 0; }
.receipt-item .meta { font-size: 0.75rem; color: #999; }
.receipt-item .amount {
    font-weight: 700;
    font-size: 1rem;
    color: #6c63ff;
    white-space: nowrap;
}
.receipt-item .actions { display: flex; gap: 6px; }

.btn {
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(0.95); }
.btn-danger { background: #ff4d4f; color: #fff; }
.btn-edit   { background: #f0f0f0; color: #333; }

.empty {
    text-align: center;
    color: #bbb;
    padding: 32px 0;
    font-size: 0.95rem;
}

/* ── Alt panel ── */
.bottom-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 480px;
    margin: 0 auto;
    background: #1e1e2e;
    border-radius: 20px 20px 0 0;
    overflow: hidden;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
}

/* Ekran */
.display {
    padding: 14px 20px;
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    text-align: right;
    letter-spacing: 1px;
    background: #16213e;
    min-height: 60px;
}

/* Klavye grid */
.keyboard {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: #111;
    touch-action: manipulation;
}

.key {
    background: #2a2a3e;
    color: #fff;
    border: none;
    padding: 0;
    height: 64px;
    font-size: 1.4rem;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    transition: background 0.08s, transform 0.08s;
}
.key:active, .key.pressed {
    background: #4a4a6e;
    transform: scale(0.93);
}

.key-action {
    background: #3a3a4e;
    color: #aaa;
    font-size: 1.2rem;
}
.key-action:active, .key-action.pressed { background: #5a5a7e; }

.key-wide { grid-column: span 2; }

.key-enter {
    background: #6c63ff;
    font-size: 1.6rem;
    grid-row: span 2;
}
.key-enter:active, .key-enter.pressed { background: #4a42d0; }

/* ── Banka seçim ekranı ── */
.subtitle {
    color: #999;
    font-size: 0.9rem;
    margin-bottom: 20px;
    margin-top: -10px;
}

.bank-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }

.bank-card {
    background: #fff;
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    text-decoration: none;
    color: inherit;
    position: relative;
    border-left: 4px solid var(--c, #6c63ff);
}

.bank-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.3rem;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
}
.bank-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}
.cash-icon {
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
}

.bank-info { flex: 1; min-width: 0; }
.bank-name { font-weight: 700; font-size: 1rem; }
.bank-total { font-size: 0.8rem; color: #999; margin-top: 2px; }
.bank-arrow { font-size: 1.5rem; color: #ccc; }

.btn-del-bank {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 4px;
    opacity: 0.5;
}
.btn-del-bank:active { opacity: 1; }

.btn-add-bank {
    width: 100%;
    background: #fff;
    border: 2px dashed #d0d0d0;
    border-radius: 14px;
    padding: 16px;
    font-size: 1rem;
    color: #999;
    cursor: pointer;
    transition: border-color .2s, color .2s;
}
.btn-add-bank:active { border-color: #6c63ff; color: #6c63ff; }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: flex-end;
    z-index: 200;
}
.modal {
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 24px 20px 40px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.modal h2 { font-size: 1.1rem; }
.modal input[type="text"] {
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 1rem;
    outline: none;
    width: 100%;
}
.modal input[type="text"]:focus { border-color: #6c63ff; }
.color-row { display: flex; align-items: center; gap: 12px; font-size: 0.9rem; color: #666; }
.color-row input[type="color"] { width: 44px; height: 36px; border: none; border-radius: 8px; cursor: pointer; }
.modal-actions { display: flex; gap: 10px; }
.btn { border: none; border-radius: 10px; padding: 12px 20px; font-size: 1rem; font-weight: 600; cursor: pointer; flex: 1; }
.btn-primary { background: #6c63ff; color: #fff; }
.btn-ghost { background: #f0f0f0; color: #333; }

/* ── Fiş ekranı ── */
.page-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.page-header h1 { font-size: 1.4rem; font-weight: 700; }
.back-btn {
    font-size: 1.8rem;
    color: #6c63ff;
    text-decoration: none;
    line-height: 1;
    padding: 0 4px;
}

/* ── Hedef kartı ── */
.target-card {
    background: #fff;
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    margin-bottom: 14px;
}
.target-label { font-size: 0.8rem; color: #999; margin-bottom: 6px; }
.target-input-row { display: flex; align-items: center; gap: 8px; }
.target-prefix { font-size: 1.3rem; font-weight: 700; color: #6c63ff; }
.target-input-row input {
    flex: 1;
    border: none;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a2e;
    outline: none;
    background: transparent;
    caret-color: transparent;
}
.btn-target-edit { background: none; border: none; font-size: 1.1rem; cursor: pointer; }

/* Bitir butonu */
.btn-finish {
    width: 100%;
    background: #1a1a2e;
    color: #fff;
    border: none;
    border-radius: 14px;
    padding: 16px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 16px;
    touch-action: manipulation;
}
.btn-finish:active { opacity: 0.8; }

/* Modal klavye */
.modal { gap: 0; padding: 0; overflow: hidden; }
.modal-display {
    background: #16213e;
    color: #fff;
    font-size: 2rem;
    font-weight: 700;
    text-align: right;
    padding: 16px 20px;
}

/* ── Rapor ── */
.report-date { font-size: 0.85rem; color: #999; margin-bottom: 16px; }

.report-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}
.summary-card {
    background: #fff;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    text-align: center;
}
.summary-label { font-size: 0.8rem; color: #999; margin-bottom: 6px; }
.summary-value { font-size: 1.2rem; font-weight: 700; color: #1a1a2e; }

.diff-card {
    border-radius: 14px;
    padding: 18px;
    text-align: center;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.diff-label { font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; opacity: 0.8; }
.diff-value { font-size: 2rem; font-weight: 800; }

.diff-over  { background: #fff0f0; color: #e53935; }
.diff-under { background: #fff8e1; color: #f57c00; }
.diff-exact { background: #e8f5e9; color: #2e7d32; }

.section-title { font-size: 0.85rem; font-weight: 700; color: #999; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Auth ── */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: #f0f2f5;
}
.auth-card {
    background: #fff;
    border-radius: 20px;
    padding: 32px 24px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    text-align: center;
}
.auth-logo { font-size: 2.5rem; margin-bottom: 8px; }
.auth-card h1 { font-size: 1.4rem; margin-bottom: 4px; }
.auth-sub { color: #999; font-size: 0.9rem; margin-bottom: 24px; }
.auth-error   { background: #fff0f0; color: #e53935; border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; font-size: 0.9rem; }
.auth-success { background: #e8f5e9; color: #2e7d32; border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; font-size: 0.9rem; }
.auth-field { text-align: left; margin-bottom: 14px; }
.auth-field label { font-size: 0.8rem; font-weight: 600; color: #666; display: block; margin-bottom: 6px; }
.auth-field input, .auth-input {
    width: 100%;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 1rem;
    outline: none;
    transition: border-color .2s;
}
.auth-field input:focus, .auth-input:focus { border-color: #6c63ff; }
.auth-input { margin: 0; }
select.auth-input { background: #fff; color: #1a1a2e; }
.btn-auth {
    width: 100%;
    background: #6c63ff;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 14px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
    touch-action: manipulation;
}
.btn-auth:active { opacity: 0.85; }

/* ── Topbar ── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.topbar h1 { font-size: 1.3rem; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-user { font-size: 0.8rem; color: #666; }
.topbar-link { font-size: 0.85rem; color: #6c63ff; text-decoration: none; font-weight: 600; }

/* ── Avatar & Profile Menu ── */
.profile-wrap { position: relative; }

.avatar-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid #6c63ff;
    background: #ede9ff;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    touch-action: manipulation;
}
.avatar-btn .avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.avatar-btn .avatar-initials {
    font-size: 1rem;
    font-weight: 700;
    color: #6c63ff;
}

.profile-menu {
    display: none;
    position: absolute;
    top: 48px;
    right: 0;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    min-width: 200px;
    z-index: 999;
    overflow: hidden;
}
.profile-menu.open { display: block; }

.profile-menu-header {
    padding: 14px 16px 10px;
    border-bottom: 1px solid #f0f0f0;
}
.pm-name { font-weight: 700; font-size: 0.95rem; }
.pm-role { font-size: 0.75rem; color: #999; margin-top: 2px; }

.pm-item {
    display: block;
    padding: 12px 16px;
    font-size: 0.9rem;
    color: #1a1a2e;
    text-decoration: none;
    transition: background .15s;
}
.pm-item:active { background: #f5f5f5; }
.pm-logout { color: #e53935; border-top: 1px solid #f0f0f0; }

/* Profil sayfası */
.profile-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0 8px;
}
.avatar-large {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 3px solid #6c63ff;
    background: #ede9ff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.avatar-large img { width: 100%; height: 100%; object-fit: cover; }
.avatar-large span { font-size: 2.2rem; font-weight: 700; color: #6c63ff; }

.btn-upload {
    background: #f0f0f0;
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 600;
    color: #333;
    touch-action: manipulation;
}

/* ── Settings ── */
.settings-card {
    background: #fff;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 14px;
}
.settings-card-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

/* ── Tabs ── */
.tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    flex-shrink: 0;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    color: #666;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    white-space: nowrap;
    touch-action: manipulation;
}
.tab.active {
    background: #6c63ff;
    color: #fff;
}

/* ── Dark Mode ── */
body.dark {
    background: #0f0f1a;
    color: #e0e0f0;
}
body.dark .container { color: #e0e0f0; }
body.dark h1 { color: #e0e0f0; }

body.dark .target-card,
body.dark .settings-card,
body.dark .receipt-item,
body.dark .bank-card,
body.dark .summary-card,
body.dark .modal,
body.dark .auth-card {
    background: #1a1a2e;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

body.dark .target-input-row input,
body.dark .auth-input,
body.dark .auth-field input,
body.dark select.auth-input {
    background: #12122a;
    border-color: #2a2a4a;
    color: #e0e0f0;
}

body.dark .section-title,
body.dark .settings-card-title { color: #6060a0; }
body.dark .meta { color: #6060a0; }
body.dark .bank-name { color: #e0e0f0; }
body.dark .bank-total { color: #6060a0; }
body.dark .bank-card { background: #1a1a2e; }
body.dark .bank-arrow { color: #3a3a6a; }
body.dark .empty { color: #3a3a6a; }

body.dark .profile-menu { background: #1a1a2e; box-shadow: 0 8px 30px rgba(0,0,0,0.4); }
body.dark .profile-menu-header { border-color: #2a2a4a; }
body.dark .pm-item { color: #e0e0f0; }
body.dark .pm-item:active { background: #2a2a4a; }
body.dark .pm-logout { border-color: #2a2a4a; }

body.dark .tab { background: #1a1a2e; color: #8080b0; }
body.dark .tab.active { background: #6c63ff; color: #fff; }

body.dark .btn-ghost { background: #2a2a4a; color: #e0e0f0; }
body.dark .btn-edit  { background: #2a2a4a; color: #e0e0f0; }

body.dark .total-bar { opacity: 0.95; }
body.dark .page-header h1 { color: #e0e0f0; }
body.dark .back-btn { color: #8b83ff; }
body.dark .subtitle { color: #6060a0; }
body.dark .topbar h1 { color: #e0e0f0; }
body.dark .topbar-user { color: #8080b0; }
body.dark .avatar-btn { background: #2a2a4e; }

/* ── Theme Toggle ── */
.theme-toggle {
    display: flex;
    gap: 10px;
}
.theme-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background: #f5f5f5;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    color: #666;
    touch-action: manipulation;
    transition: all .15s;
}
.theme-btn.active {
    border-color: #6c63ff;
    background: #ede9ff;
    color: #6c63ff;
}
body.dark .theme-btn {
    background: #2a2a4a;
    border-color: #3a3a6a;
    color: #8080b0;
}
body.dark .theme-btn.active {
    border-color: #6c63ff;
    background: #3a3060;
    color: #a09aff;
}
