@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400..800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  /* --- Renk tokenları --- */
  --bg: #F8F7FC;
  --bg-panel: #FFFFFF;
  --bg-sunk: #F3F1FA;
  --ink: #191325;
  --ink-soft: #756E85;
  --ink-faint: #A29CB3;
  --line: #EBE7F5;
  --line-soft: #F2EFF9;

  --purple: #5B3A8E;
  --purple-deep: #3D2563;
  --purple-bright: #7C4FD1;
  --purple-soft: #F1EAFC;
  --purple-soft-line: #E3D6F7;

  --ok: #1F9D63;
  --ok-soft: #E7F7EF;
  --danger: #D6455A;
  --danger-soft: #FCEAEE;
  --amber: #C4881F;
  --amber-soft: #FAF1DE;

  --font-display: 'Bricolage Grotesque', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(60,40,100,.04);
  --shadow: 0 2px 8px rgba(60,40,100,.05), 0 12px 32px -12px rgba(60,40,100,.10);
  --shadow-lg: 0 20px 60px -20px rgba(60,40,100,.28);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0 0 .25em; color: var(--ink); letter-spacing: -.01em; }
h1 { font-size: 2.3rem; line-height: 1.1; font-weight: 700; }
h2 { font-size: 1.5rem; line-height: 1.2; font-weight: 700; }
h3 { font-size: 1.15rem; line-height: 1.25; font-weight: 600; color: var(--purple-deep); }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* ---------- Layout ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 244px; flex-shrink: 0;
  background: var(--bg-panel);
  border-right: 1px solid var(--line);
  color: var(--ink);
  padding: 26px 18px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 11px;
  padding: 0 6px 22px; margin-bottom: 4px; border-bottom: 1px solid var(--line-soft);
}
.sidebar .brand .mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(155deg, var(--purple-bright), var(--purple-deep));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; color: #fff;
  flex-shrink: 0;
}
.sidebar .brand .txt { line-height: 1.15; }
.sidebar .brand .txt strong { display: block; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; color: var(--ink); }
.sidebar .brand .txt small { display: block; font-size: .66rem; color: var(--ink-faint); letter-spacing: .07em; text-transform: uppercase; margin-top: 1px; }

.sidebar nav { margin-top: 18px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a {
  padding: 10px 12px; border-radius: var(--radius-sm); color: var(--ink-soft); font-size: .88rem; font-weight: 500;
  display: flex; align-items: center; gap: 11px; transition: background .15s, color .15s;
}
.sidebar nav a .ic { font-size: 1rem; width: 18px; text-align: center; opacity: .85; }
.sidebar nav a:hover { background: var(--bg-sunk); color: var(--ink); }
.sidebar nav a.active { background: var(--purple-soft); color: var(--purple-deep); font-weight: 600; }
.sidebar .userbox { border-top: 1px solid var(--line-soft); padding-top: 16px; font-size: .8rem; color: var(--ink-faint); }
.sidebar .userbox strong { color: var(--ink); display: block; font-size: .86rem; font-weight: 600; }
.sidebar .userbox a { color: var(--purple); font-weight: 600; }

.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 36px; background: transparent;
  position: sticky; top: 0; z-index: 5;
  backdrop-filter: blur(6px);
}
.topbar h2 { font-size: 1.7rem; }
.content { padding: 4px 36px 64px; }

/* ---------- Cards / panels ---------- */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 22px 24px;
}
.card + .card { margin-top: 18px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 980px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
}

/* Stat / KPI card */
.stat { position: relative; overflow: hidden; }
.stat::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--accent, linear-gradient(90deg, var(--purple-bright), var(--purple-soft-line)));
}
.stat.negative::before { background: linear-gradient(90deg, var(--danger), #F3C9CF); }
.stat.positive::before { background: linear-gradient(90deg, var(--ok), #BEE8D2); }
.stat .label { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); font-weight: 600; }
.stat .value { font-family: var(--font-display); font-weight: 700; font-size: 2rem; margin-top: 6px; color: var(--ink); letter-spacing: -.02em; }
.stat.negative .value { color: var(--danger); }
.stat.positive .value { color: var(--ok); }
.stat .sub { font-size: .78rem; color: var(--ink-soft); margin-top: 6px; }

/* ---------- Cash flow ribbon (signature element) ---------- */
.ribbon { display: flex; height: 38px; border-radius: 10px; overflow: hidden; background: var(--bg-sunk); gap: 2px; }
.ribbon .seg { display:flex; align-items:center; justify-content:center; font-family: var(--font-mono); font-size: .7rem; color: #fff; white-space: nowrap; overflow: hidden; border-radius: 3px; }
.ribbon .seg.income { background: var(--ok); }
.ribbon .seg.expense-ev { background: #5B3A8E; }
.ribbon .seg.expense-araba { background: #2C7A7B; }
.ribbon .seg.expense-cocuk { background: #B0518C; }
.ribbon .seg.expense-ortak { background: #3E5C9A; }
.ribbon .seg.expense-diger { background: #8A8496; }
.legend { display:flex; flex-wrap:wrap; gap: 14px; margin-top: 12px; font-size: .78rem; color: var(--ink-soft); }
.legend .dot { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:6px; vertical-align:middle; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); font-size: .85rem; }
th { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); font-weight: 700; background: transparent; border-bottom: 1px solid var(--line); }
tbody tr:hover { background: var(--bg-sunk); }
td.amount, th.amount { font-family: var(--font-mono); text-align: right; }
td.amount.expense { color: var(--danger); }
td.amount.income { color: var(--ok); }
.table-wrap { overflow-x: auto; }

/* Progress bar (kart limiti / borç ilerlemesi) */
.progress { height: 7px; background: var(--bg-sunk); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.progress > span { display:block; height:100%; background: var(--purple); border-radius: 4px; }
.progress.high > span { background: var(--danger); }
.progress.mid > span { background: var(--amber); }

/* ---------- Forms ---------- */
label { font-size: .78rem; font-weight: 600; color: var(--ink-soft); display:block; margin-bottom: 6px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: .88rem; background: var(--bg-panel); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--purple-bright); box-shadow: 0 0 0 3px var(--purple-soft); }
.field { margin-bottom: 14px; }
.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row .field { flex: 1; min-width: 160px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px; border-radius: 999px; border: 1px solid transparent;
  font-size: .84rem; font-weight: 600; cursor: pointer; font-family: var(--font-body);
  transition: transform .1s, box-shadow .15s, background .15s;
}
.btn-primary { background: var(--purple-deep); color: #fff; box-shadow: 0 1px 2px rgba(61,37,99,.15); }
.btn-primary:hover { background: var(--purple); box-shadow: 0 4px 14px rgba(91,58,142,.28); }
.btn-amber { background: var(--amber-soft); color: var(--amber); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--purple-soft-line); color: var(--purple-deep); }
.btn-sm { padding: 6px 13px; font-size: .76rem; }

/* ---------- Badges ---------- */
.badge { display:inline-block; padding: 4px 11px; border-radius: 999px; font-size: .68rem; font-weight: 700; letter-spacing: .01em; }
.badge.ev { background:#F1EAFC; color:#5B3A8E; }
.badge.araba { background:#E4F3F2; color:#2C7A7B; }
.badge.cocuk { background:#FBEAF2; color:#B0518C; }
.badge.ortak { background:#EAEFF9; color:#3E5C9A; }
.badge.diger { background:#F0EFF3; color:#8A8496; }
.badge.paid { background: var(--ok-soft); color: var(--ok); }
.badge.unpaid { background: var(--bg-sunk); color: var(--ink-soft); }
.badge.soon { background: var(--amber-soft); color: var(--amber); }
.badge.over { background: var(--danger-soft); color: var(--danger); font-weight: 700; }

/* ---------- Alerts / flash ---------- */
.alert { padding: 13px 18px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: .86rem; border: 1px solid transparent; }
.alert.success { background: var(--ok-soft); color: var(--ok); border-color: #CBEEDA; }
.alert.error { background: var(--danger-soft); color: var(--danger); border-color: #F5D0D6; }
.alert.info { background: var(--purple-soft); color: var(--purple-deep); border-color: var(--purple-soft-line); }

/* ---------- Login / install page ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(720px 420px at 15% 10%, #EDE1FB 0%, transparent 60%),
    radial-gradient(680px 460px at 85% 90%, #E7EEFB 0%, transparent 55%),
    var(--bg);
}
.login-card {
  background: var(--bg-panel); padding: 44px 40px; border-radius: 22px; width: 380px;
  box-shadow: var(--shadow-lg); border: 1px solid var(--line);
}
.login-card h1 { font-size: 1.8rem; margin-bottom: 4px; }
.login-card p.tag { color: var(--ink-soft); font-size: .86rem; margin-bottom: 26px; }

/* Utility */
.flex { display:flex; align-items:center; }
.flex.between { justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.muted { color: var(--ink-soft); }
.mt-0 { margin-top: 0; } .mt-16 { margin-top: 16px; } .mb-16 { margin-bottom: 16px; }
.section-title { display:flex; align-items:center; justify-content:space-between; margin-bottom: 14px; }
.empty { text-align:center; padding: 46px 20px; color: var(--ink-faint); }
.empty .big { font-size: 2rem; margin-bottom: 10px; }

@media (max-width: 760px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; overflow-x: auto; padding: 16px; }
  .sidebar .brand { border-bottom: none; padding-bottom: 0; margin-bottom: 0; margin-right: 10px; }
  .sidebar nav { flex-direction: row; margin-top: 0; }
  .sidebar .userbox { display: none; }
  .content { padding: 18px; }
  .topbar { padding: 16px 18px; }
}
