/*
 * CepteDurum web goruntuleyici.
 * Renkler uygulamanin tasarim sisteminden (Android core/designsystem/Color.kt,
 * iOS Theme.swift): ana yesil #0F5132, gelir yesil, gider turuncu-kirmizi,
 * borc kiremit. Yazi tipi Manrope (SIL Open Font License), Latin + Turkce alt kume.
 */

@font-face {
  font-family: "Manrope";
  src: url("fonts/manrope.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --primary: #0F5132;
  --on-primary: #FFFFFF;
  --primary-container: #C9DDD2;
  --secondary: #6E8478;
  --bg: #F4F7F5;
  --surface: #FFFFFF;
  --surface-container: #EFF4F1;
  --on-bg: #12241D;
  --muted: #5E6E67;
  --outline: #D6E0DA;
  --income: #0F5132;
  --expense: #E4572E;
  --warning: #B45309;
  --debt: #C4441E;
  --header: linear-gradient(160deg, #0F5132 0%, #0B6B4F 60%, #0D7A63 100%);
  --shadow: 0 1px 2px rgba(18, 36, 29, .06), 0 4px 16px rgba(18, 36, 29, .05);
  --radius: 20px;
  --radius-sm: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #62D9C3;
    --on-primary: #00382F;
    --primary-container: #1D3A31;
    --secondary: #9DB3A8;
    --bg: #0B100F;
    --surface: #141B19;
    --surface-container: #1A2320;
    --on-bg: #DDE5E1;
    --muted: #93A59C;
    --outline: #2A3531;
    --income: #62D9C3;
    --expense: #FF8A65;
    --warning: #F2B35B;
    --debt: #FF8A65;
    --header: linear-gradient(160deg, #04413A 0%, #075A4C 60%, #0A6E60 100%);
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--on-bg);
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); }
button { font: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.income { color: var(--income); }
.expense { color: var(--expense); }
.debt { color: var(--debt); }
.warning { color: var(--warning); }

/* --- Iskelet: masaustunde yan menu, telefonda alt menu --- */

.shell { display: flex; min-height: 100vh; }

.nav {
  width: 232px;
  flex-shrink: 0;
  padding: 20px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--outline);
  background: var(--surface);
}

.brand { font-weight: 800; font-size: 18px; padding: 4px 12px 16px; color: var(--primary); }
.nav-group { font-size: 12px; font-weight: 700; color: var(--muted); padding: 14px 12px 6px; text-transform: uppercase; letter-spacing: .04em; }

.nav-item {
  text-decoration: none;
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--on-bg);
  cursor: pointer;
  font-weight: 600;
}
.nav-item:hover { background: var(--surface-container); }
.nav-item.active { background: var(--primary-container); color: var(--primary); }

.main { flex: 1; min-width: 0; padding: 24px 28px 64px; max-width: 1160px; }

@media (max-width: 760px) {
  .shell { display: block; }
  .nav {
    position: fixed; bottom: 0; top: auto; left: 0; right: 0; z-index: 10;
    width: auto; height: auto; padding: 6px; display: flex; gap: 4px; overflow-x: auto;
    border-right: 0; border-top: 1px solid var(--outline);
  }
  .brand, .nav-group { display: none; }
  .nav-item { flex: 0 0 auto; width: auto; font-size: 13px; padding: 8px 12px; }
  .main { padding: 16px 16px 88px; }
}

/* --- Ust kisim --- */

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.topbar h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.01em; }

.freshness {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--surface-container); color: var(--muted); font-size: 13px; margin-bottom: 18px;
}
.freshness.stale { background: rgba(180, 83, 9, .12); color: var(--warning); }

.hero {
  background: var(--header);
  color: #fff;
  border-radius: 0 0 30px 30px;
  padding: 22px 24px 26px;
  margin: -24px -28px 22px;
}
.hero .label { opacity: .85; font-size: 14px; }
.hero .big { font-size: 38px; font-weight: 800; letter-spacing: -1.1px; font-variant-numeric: tabular-nums; }
.hero .row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.hero .pill { background: rgba(255, 255, 255, .14); border-radius: 14px; padding: 10px 14px; min-width: 150px; }
.hero .pill b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .hero { margin: -16px -16px 18px; } .hero .big { font-size: 32px; } }

/* --- Kartlar ve izgara --- */

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card { background: var(--surface); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); border: 1px solid var(--outline); }
.card h2 { margin: 0 0 12px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.card .value { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }

.line { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--outline); }
.line:last-child { border-bottom: 0; }
.line .amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

.bar { height: 8px; border-radius: 8px; background: var(--surface-container); overflow: hidden; margin-top: 6px; }
.bar > span { display: block; height: 100%; background: var(--primary); border-radius: 8px; }
.bar.near > span { background: var(--warning); }
.bar.over > span { background: var(--expense); }
.bar.reached > span { background: var(--income); }

/* --- Tablo --- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--outline); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; position: sticky; top: 0; background: var(--surface); }
td.amount, th.amount { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* --- Form ve dugmeler --- */

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
input, select {
  font: inherit; color: var(--on-bg); background: var(--surface);
  border: 1px solid var(--outline); border-radius: 12px; padding: 9px 12px;
}
input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: -1px; }

.btn {
  border: 0; border-radius: 14px; padding: 11px 18px; cursor: pointer; font-weight: 700;
  background: var(--primary); color: var(--on-primary);
}
.btn.secondary { background: var(--surface-container); color: var(--on-bg); }
.btn.link { background: none; color: var(--primary); padding: 6px 4px; }
.btn[disabled] { opacity: .55; cursor: default; }

.chip { border: 1px solid var(--outline); background: var(--surface); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-weight: 600; color: var(--on-bg); }
.chip.on { background: var(--primary-container); color: var(--primary); border-color: transparent; }

/* --- Giris --- */

.auth { max-width: 420px; margin: 8vh auto; padding: 0 16px; }
.auth .card { padding: 26px; }
.auth h1 { font-size: 26px; margin: 0 0 6px; color: var(--primary); font-weight: 800; }
.auth form { display: grid; gap: 10px; margin-top: 16px; }
.auth .providers { display: grid; gap: 10px; margin-top: 18px; }
.auth .divider { text-align: center; color: var(--muted); font-size: 13px; margin: 16px 0 0; }
.notice { padding: 12px 14px; border-radius: 12px; background: var(--surface-container); font-size: 14px; margin-top: 12px; }
.notice.error { background: rgba(228, 87, 46, .12); color: var(--expense); }

.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty b { display: block; color: var(--on-bg); font-size: 18px; margin-bottom: 6px; }

/* --- Liste satirlari, secenekler, donem --- */

.small { font-size: 13px; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }

.list { padding: 6px 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--outline); }
.row:last-child { border-bottom: 0; }
.row .amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.status { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; background: var(--surface-container); flex-shrink: 0; }
.line > .status { align-self: center; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

.period { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0 14px; }
.period-label { font-weight: 700; min-width: 120px; text-align: center; }
.icon-btn { border: 0; background: rgba(255, 255, 255, .14); color: inherit; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 20px; line-height: 1; }
.icon-btn[disabled] { opacity: .35; cursor: default; }
.seg { display: inline-flex; background: rgba(255, 255, 255, .14); border-radius: 999px; padding: 3px; margin-left: auto; }
.seg-item { border: 0; background: none; color: inherit; padding: 6px 14px; border-radius: 999px; cursor: pointer; font-weight: 700; }
.seg-item.on { background: var(--surface); color: var(--primary); }
.main > .period .icon-btn, .main > .period .seg { background: var(--surface-container); }

.nav-foot { padding: 18px 12px 6px; border-top: 1px solid var(--outline); margin-top: 14px; }
@media (max-width: 760px) { .nav-foot { display: none; } }

/* --- Ana sayfa --- */

.hero .label { color: rgba(255, 255, 255, .78); }
.hero-row { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .12); color: #fff; text-decoration: none; }
.forecast { display: inline-block; margin-top: 12px; padding: 8px 14px; border-radius: 999px; font-size: 14px; }
.forecast.ok { color: #B9F0D2; background: rgba(167, 232, 198, .18); }
.forecast.short { color: #FFD2C7; background: #7A3020; }
.forecast .dim { opacity: .85; }
.hero .period { color: #fff; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.row2 .pill { background: rgba(255, 255, 255, .12); border-radius: 18px; padding: 12px 14px; }
.row2 .pill b { display: block; font-size: 18px; margin-top: 4px; font-variant-numeric: tabular-nums; }

.line-inner { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.line.stack { display: block; }

.donut { width: 168px; height: 168px; border-radius: 50%; margin: 6px auto 14px; display: flex; align-items: center; justify-content: center; }
.donut-hole { width: 66%; height: 66%; border-radius: 50%; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.slice-name { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; display: inline-block; }

.bars2 { display: flex; justify-content: center; gap: 36px; padding-top: 8px; }
.bars2-col { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bars2-track { height: 120px; display: flex; align-items: flex-end; }
.bars2-bar { width: 56px; border-radius: 10px 10px 4px 4px; }
.income-bg { background: var(--income); }
.expense-bg { background: var(--expense); }
.year-bars { display: flex; gap: 6px; overflow-x: auto; padding-top: 8px; }
.year-col { width: 40px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.year-pair { height: 120px; display: flex; align-items: flex-end; gap: 3px; }
.mini { width: 12px; border-radius: 4px 4px 2px 2px; }

.period.plain .icon-btn, .period.plain .seg { background: var(--surface-container); }
.period.plain .seg { margin-left: 0; margin-right: 8px; }
.divider-line { height: 1px; background: var(--outline); margin: 6px 0; }
.collapse-head { display: flex; width: 100%; justify-content: space-between; align-items: center; border: 0; background: none; padding: 0; cursor: pointer; color: inherit; font: inherit; }
.collapse-head h2 { margin: 0; }
.card .collapse-head + * { margin-top: 12px; }

/* --- Islemler, net varlik --- */

.toolbar input[type=search] { flex: 1; min-width: 220px; }
.toolbar .chips { margin: 0; }
.day-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; font-weight: 700; margin: 16px 6px 6px; }
.badge { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 800; flex-shrink: 0; }
.big-value { font-size: 34px; font-weight: 800; letter-spacing: -1px; font-variant-numeric: tabular-nums; margin: 4px 0 12px; }
.primary { color: var(--primary); }
.row2.plain .pill { background: var(--surface-container); color: var(--on-bg); }
.section-title { font-size: 16px; margin: 22px 4px 12px; }
.cash-chart { display: flex; gap: 10px; justify-content: space-between; padding-top: 8px; }
.cash-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.cash-pos { height: 110px; display: flex; align-items: flex-end; }
.with-neg .cash-pos { height: 55px; }
.cash-neg { height: 55px; display: flex; align-items: flex-start; border-top: 1px solid var(--outline); width: 100%; justify-content: center; }
.cash-bar { width: 22px; border-radius: 6px; }
.primary-bg { background: var(--primary); }
.debt-bg { background: var(--debt); }

/* --- Borclar --- */

.clickable { cursor: pointer; }
.card h2.sub { margin: 16px 0 6px; }
.tag { display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.tag.ok { background: var(--primary-container); color: var(--primary); }
.tag.bad { background: rgba(228, 87, 46, .14); color: var(--expense); }
.note { margin: 8px 4px 18px; }
.card label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 6px; }
.card input { width: 100%; }
.card.tinted { background: var(--primary-container); border-color: transparent; }
.card.flat { padding: 14px 16px; border-bottom: 1px solid var(--outline); }
