/* ============ Tasarım Token'ları ============ */
:root {
  --bg: #f3f5fb;
  --surface: #ffffff;
  --surface-2: #f8f9fd;
  --border: #e7e9f3;
  --text: #1a1d2e;
  --text-dim: #6b7090;
  --text-faint: #9aa0bf;

  --brand-1: #6d5efc;
  --brand-2: #22d3ee;
  --brand-grad: linear-gradient(135deg, var(--brand-1), var(--brand-2));

  --income: #16a34a;
  --income-bg: #ecfdf5;
  --expense: #e11d48;
  --expense-bg: #fff1f2;
  --net: #2563eb;
  --net-bg: #eff6ff;
  --balance: #7c3aed;
  --balance-bg: #f5f3ff;

  --navy-1: #14152a;
  --navy-2: #1d1f3d;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-soft: 0 4px 18px rgba(24, 26, 60, 0.06);
  --shadow-card: 0 2px 8px rgba(24, 26, 60, 0.05);
  --shadow-pop: 0 18px 45px rgba(24, 26, 60, 0.18);

  --font-display: 'Outfit', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0 0 4px; }
button { font-family: inherit; }
a { color: var(--brand-1); text-decoration: none; }
::selection { background: rgba(109, 94, 252, 0.25); }

/* ============ Auth Sayfaları ============ */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 15%, rgba(109,94,252,0.35), transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(34,211,238,0.30), transparent 45%),
    var(--navy-1);
}
.auth-wrap { width: 100%; max-width: 420px; }
.auth-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-pop);
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.brand-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--brand-grad);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-family: var(--font-display);
  font-size: 1.05rem;
  box-shadow: 0 6px 16px rgba(109,94,252,0.35);
}
.brand-text { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; }
.auth-title { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }
.auth-sub { color: var(--text-dim); margin: 0 0 20px; font-size: 0.92rem; }

.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
  line-height: 1.5;
}
.alert-error { background: var(--expense-bg); color: var(--expense); }
.alert-success { background: var(--income-bg); color: var(--income); }

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.8rem; font-weight: 600; color: var(--text-dim); }
.field input {
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  background: var(--surface-2);
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus {
  outline: none;
  border-color: var(--brand-1);
  box-shadow: 0 0 0 4px rgba(109,94,252,0.12);
  background: #fff;
}

.btn-primary {
  background: var(--brand-grad);
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, opacity .12s;
  box-shadow: 0 8px 20px rgba(109,94,252,0.28);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-primary:hover { transform: translateY(-1px); opacity: 0.95; }
.btn-primary:active { transform: translateY(0); }
.btn-block { width: 100%; margin-top: 4px; }

.auth-foot { text-align: center; margin-top: 20px; font-size: 0.87rem; color: var(--text-dim); }
.auth-foot a { font-weight: 700; }

/* ============ App Shell ============ */
.app-body { background: var(--bg); }
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--navy-2), var(--navy-1));
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; margin-bottom: 28px; }
.sidebar-brand .brand-text { color: #fff; }

.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.side-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.65);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background .15s, color .15s;
}
.side-link .ic { font-size: 1rem; width: 20px; text-align: center; opacity: 0.9; }
.side-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.side-link.active {
  background: rgba(109,94,252,0.25);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(109,94,252,0.4);
}

.sidebar-foot { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 14px; margin-top: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 8px 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-grad);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; color: #fff;
}
.user-name { font-size: 0.86rem; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-link {
  display: block; text-align: center;
  font-size: 0.82rem; font-weight: 700;
  color: rgba(255,255,255,0.7);
  padding: 9px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.14);
}
.logout-link:hover { background: rgba(255,255,255,0.08); color: #fff; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px 0;
  flex-wrap: wrap;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.mobile-brand { display: none; font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; }
.mobile-settings-btn {
  display: none;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  font-size: 1rem;
  cursor: pointer;
}
.mobile-logout-link { display: inline-flex; margin-top: 10px; }
.month-nav { display: flex; align-items: center; gap: 8px; background: var(--surface); padding: 6px; border-radius: 999px; box-shadow: var(--shadow-card); }
.month-label { font-weight: 700; font-size: 0.88rem; min-width: 120px; text-align: center; }
.icon-btn {
  background: var(--surface-2);
  border: none;
  color: var(--text);
  width: 30px; height: 30px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.icon-btn:hover { background: var(--border); }
.ghost-btn {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-dim);
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
}
.ghost-btn:hover { background: var(--surface-2); }
.fab-add {
  background: var(--brand-grad);
  color: #fff;
  border: none;
  padding: 11px 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(109,94,252,0.3);
}
.fab-add:hover { transform: translateY(-1px); }

/* ============ Özet Kartları ============ */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  padding: 16px 24px 0;
}
.card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
}
.card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card-label { font-size: 0.76rem; color: var(--text-dim); font-weight: 600; }
.card-ic {
  width: 26px; height: 26px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700;
}
.card.income .card-ic { background: var(--income-bg); color: var(--income); }
.card.expense .card-ic { background: var(--expense-bg); color: var(--expense); }
.card.net .card-ic { background: var(--net-bg); color: var(--net); }
.card.balance .card-ic { background: var(--balance-bg); color: var(--balance); }
.card-value { font-size: 1.32rem; font-weight: 800; letter-spacing: -0.01em; }
.card.income .card-value { color: var(--income); }
.card.expense .card-value { color: var(--expense); }
.card.net .card-value { color: var(--net); }
.card.balance .card-value { color: var(--balance); }

/* ============ İçerik ============ */
main { padding: 18px 24px 90px; max-width: 1200px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }

.panel {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
}
.panel h3 { font-size: 1rem; font-weight: 700; }
.muted { color: var(--text-faint); font-weight: 500; font-size: 0.82rem; }
.hint { color: var(--text-dim); font-size: 0.84rem; line-height: 1.55; }

.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 14px; font-size: 0.8rem; color: var(--text-dim); }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

/* ============ İşlem Satırları ============ */
.tx-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.tx-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  gap: 10px;
}
.tx-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tx-desc { font-weight: 700; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-meta { font-size: 0.76rem; color: var(--text-faint); }
.tx-amount { font-weight: 800; min-width: 96px; text-align: right; font-size: 0.92rem; }
.tx-amount.gelir { color: var(--income); }
.tx-amount.gider { color: var(--expense); }
.tx-actions { display: flex; gap: 6px; flex-shrink: 0; }
.tx-actions button {
  border: none;
  background: var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.8rem;
}
.tx-actions button:hover { background: #dcdfee; }

/* ============ Kategori Listesi ============ */
.cat-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.cat-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}
.cat-row button {
  border: none;
  background: var(--expense-bg);
  color: var(--expense);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
}
.inline-form { display: flex; gap: 8px; }
.inline-form input {
  flex: 1; padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  background: var(--surface-2);
}
.inline-form input:focus { outline: none; border-color: var(--brand-1); background: #fff; }

/* ============ Filtreler & Tablo ============ */
.filter-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters select, .filters input {
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  background: var(--surface-2);
}
table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 0.85rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--text-dim); font-weight: 700; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; }
td.tx-amount { text-align: right; }
.table-scroll { overflow-x: auto; }
.row-actions { display: flex; gap: 4px; }
.row-actions button { border: none; background: var(--surface-2); border-radius: 8px; padding: 4px 8px; cursor: pointer; }

/* ============ Modal ============ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,16,35,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}
.modal-overlay.open { display: flex; }
.modal-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 22px 22px 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-pop);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }

.form-row { margin-bottom: 12px; display: flex; flex-direction: column; gap: 6px; }
.form-row label { font-size: 0.8rem; color: var(--text-dim); font-weight: 600; }
.form-row input, .form-row select {
  padding: 11px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  background: var(--surface-2);
}
.form-row input:focus, .form-row select:focus { outline: none; border-color: var(--brand-1); background: #fff; }
.checkbox-row label { flex-direction: row; display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text); }
.checkbox-row input { width: auto; }

.type-toggle { display: flex; gap: 8px; }
.type-btn {
  flex: 1;
  padding: 11px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-dim);
}
.type-btn[data-type="gider"].active { background: var(--expense-bg); border-color: var(--expense); color: var(--expense); }
.type-btn[data-type="gelir"].active { background: var(--income-bg); border-color: var(--income); color: var(--income); }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ============ Bottom Nav (Mobil) ============ */
.bottom-nav { display: none; }

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--navy-1);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 600;
  opacity: 0;
  transition: all 0.25s;
  pointer-events: none;
  z-index: 1100;
  box-shadow: var(--shadow-pop);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ Responsive: Tablet ============ */
@media (max-width: 1024px) {
  .summary-cards { grid-template-columns: repeat(2, 1fr); }
}

/* ============ Responsive: Mobil ============ */
@media (max-width: 800px) {
  .sidebar { display: none; }
  .mobile-brand { display: inline-flex; }
  .mobile-settings-btn { display: inline-flex; align-items: center; justify-content: center; }
  .app-shell { flex-direction: column; }
  main { padding: 14px 14px 100px; }
  .topbar { padding: 14px 14px 0; }
  .summary-cards { grid-template-columns: repeat(2, 1fr); padding: 12px 14px 0; gap: 10px; }
  .card { padding: 13px 14px; }
  .card-value { font-size: 1.12rem; }
  .grid-2 { grid-template-columns: 1fr; }
  .fab-add { display: none; }
  .panel { padding: 15px 16px; }

  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    justify-content: space-between;
    align-items: center;
    z-index: 900;
    box-shadow: 0 -8px 24px rgba(24,26,60,0.06);
  }
  .bottom-link {
    background: none; border: none;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    color: var(--text-faint);
    font-size: 0.65rem;
    font-weight: 700;
    flex: 1;
    padding: 4px 0;
    cursor: pointer;
  }
  .bottom-link .ic { font-size: 1.05rem; }
  .bottom-link.active { color: var(--brand-1); }
  .bottom-add {
    background: var(--brand-grad) !important;
    color: #fff !important;
    width: 48px; height: 48px;
    border-radius: 50%;
    margin-top: -26px;
    box-shadow: 0 10px 22px rgba(109,94,252,0.4);
    flex: 0 0 48px;
  }
  .bottom-add .ic { font-size: 1.4rem; }

  .month-label { min-width: 100px; font-size: 0.82rem; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-card { border-radius: 22px 22px 0 0; max-width: 100%; }
}

@media (max-width: 420px) {
  .summary-cards { grid-template-columns: 1fr 1fr; }
  .card-value { font-size: 1.02rem; }
}
