/* Safe Money — tema, layout, ana ekran */
/* ==== Tema: Graphite & Silver (premium) ====
   Qaranlıq (defolt): qrafit fon, gümüşü mətn və vurğu. İşıqlı: açıq boz fon, qrafit düymələr, polad vurğu.
   Qayda: tək vurğu rəngi (gümüşü), qradiyent/parıltı yoxdur, rəng yalnız məna daşıyanda (xəta, uğur, kateqoriya).
   --brand     : əsas düymə dolğusu        --on-brand : həmin düymənin üstündəki mətn
   --brand-ink : vurğu mətni / ikon         --hero-*   : balans kartı ("metal kart") */
:root{
  --bg: #f3f4f6;
  --panel: #ffffff;
  --panel-alt: #f7f8f9;
  --ink: #15171a;
  --muted: #666c74;
  --faint: #a4a9b0;
  --line: #e2e5e9;
  --brand: #1c1f23;
  --brand-deep: #0f1113;
  --brand-soft: #33383e;
  --brand-ink: #4a5059;
  --on-brand: #f3f4f6;
  --accent: #7d848d;
  --accent-soft: #eef0f2;
  --accent-line: #dde1e5;
  --accent-ink: #4a5059;
  --accent-ink-dark: #15171a;
  --accent-track: rgba(74,80,89,0.14);
  --hero-bg: #1c1f23;
  --hero-line: #2c3036;
  --hero-ink: #f1f3f5;
  --on-brand-1: #a3a9b1;
  --on-brand-2: #858b93;
  --on-brand-3: #dfe2e6;
  --chart-1: #2b2f34;
  --chart-2: #8b929b;
  --chart-3: #c9ced6;
  --danger: #c2493d;
  --danger-bg: #fbeceb;
  --danger-bg-soft: #fdf5f4;
  --success-bg: #e8f3ee;
  --success-ink: #2f7a57;
  --input-border: #d6dade;
  --swatch-border: #ffffff;
  --overlay: rgba(15,17,19,0.45);
  --shadow: rgba(15,17,19,0.08);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0b0c0e;
  --panel: #141619;
  --panel-alt: #1a1d21;
  --ink: #e8eaed;
  --muted: #979ca4;
  --faint: #5c6168;
  --line: #25282d;
  --brand: #d4d8de;
  --brand-deep: #aab0b8;
  --brand-soft: #e6e9ed;
  --brand-ink: #c9ced6;
  --on-brand: #0b0c0e;
  --accent: #c9ced6;
  --accent-soft: #16181b;
  --accent-line: #2a2e33;
  --accent-ink: #b3b9c1;
  --accent-ink-dark: #eef0f3;
  --accent-track: rgba(201,206,214,0.14);
  --hero-bg: #16181b;
  --hero-line: #2a2e33;
  --hero-ink: #f1f3f5;
  --on-brand-1: #9ea4ac;
  --on-brand-2: #7d838b;
  --on-brand-3: #d5d9de;
  --chart-1: #d4d8de;
  --chart-2: #8b929b;
  --chart-3: #4d535a;
  --danger: #e0776b;
  --danger-bg: #2a1715;
  --danger-bg-soft: #1d1413;
  --success-bg: #13221b;
  --success-ink: #7cc4a0;
  --input-border: #2e3237;
  --swatch-border: #141619;
  --overlay: rgba(0,0,0,0.72);
  --shadow: rgba(0,0,0,0.5);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; } /* iPhone mətni özbaşına böyütməsin */
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  margin: 0;
  padding: 20px 14px calc(86px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  color: var(--ink);
  transition: background .2s, color .2s;
  touch-action: manipulation; /* iOS-da çift toxunuşla yaxınlaşdırmanı söndürür — native tətbiq hissi */
}
.container { width: 100%; max-width: 430px; }

.top {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 18px;
}
.top h1 {
  font-size: 19px; font-weight: 600; letter-spacing: 0.01em; margin: 0; color: var(--ink);
}

/* ==== Alt naviqasiya paneli (bottom tab bar) ==== */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  display: flex; justify-content: center; background: var(--panel);
  border-top: 1px solid var(--line);
}
.bottom-nav-inner {
  display: flex; width: 100%; max-width: 430px; margin: 0 auto;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; background: none; border: none; cursor: pointer; padding: 6px 2px 5px;
  color: var(--muted); font-size: 10.5px; font-weight: 600; border-radius: 12px;
  transition: color .15s, background .15s;
}
.nav-item:active { background: var(--panel-alt); }
.nav-item .nav-icon { line-height: 0; display: flex; transition: transform .15s; }
.nav-item .nav-icon svg { stroke-width: 1.6; }
.nav-item.active { color: var(--ink); }
.nav-item.active .nav-icon svg { stroke-width: 2; }
.nav-item.active .nav-icon { transform: translateY(-1px); }

.summary-card {
  background: var(--hero-bg); border: 1px solid var(--hero-line); color: var(--hero-ink); border-radius: var(--radius-lg);
  padding: 20px 20px 18px; margin-bottom: 14px; position: relative; overflow: hidden;
}
.summary-label { font-size: 12px; color: var(--on-brand-1); font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }
.summary-amount { font-size: 34px; font-weight: 600; margin-top: 4px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.summary-sub { font-size: 12px; color: var(--on-brand-2); margin-top: 6px; }

.daily-limit-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 14px 16px; margin-bottom: 14px; transition: background .2s, border-color .2s;
}
.daily-limit-card.over { border-color: var(--danger); background: var(--danger-bg-soft); }
.daily-limit-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.daily-limit-head .lbl { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.daily-limit-head .lbl.over { color: var(--danger); }
.daily-limit-head .pct { font-size: 13px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.daily-limit-head .pct.over { color: var(--danger); }
.daily-limit-bar-bg { width: 100%; height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin-bottom: 8px; }
.daily-limit-bar-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width .2s, background .2s; }
.daily-limit-bar-fill.over { background: var(--danger); }
.daily-limit-foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.daily-limit-foot .qalan { font-weight: 600; color: var(--ink); }
.daily-limit-foot .qalan.over { color: var(--danger); }

.progress-bar-container {
  width: 100%; height: 6px; background: rgba(255,255,255,0.08); border-radius: 999px;
  overflow: hidden; display: flex; gap: 2px; margin: 16px 0 12px;
}
.breakdown { display: flex; flex-direction: column; gap: 6px; }
.breakdown-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12.5px; color: var(--on-brand-3);
}
.breakdown-row .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.breakdown-empty { font-size: 12.5px; color: var(--on-brand-2); text-align: center; padding: 6px 0; }

.insight-strip {
  display: flex; gap: 10px; margin-bottom: 18px;
}
.insight-box {
  flex: 1; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 10px 12px;
}
.insight-box .k { font-size: 11px; color: var(--muted); font-weight: 500; }
.insight-box .v { font-size: 15px; font-weight: 600; margin-top: 2px; color: var(--ink); font-variant-numeric: tabular-nums; }

.grid-buttons {
  display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin-bottom: 14px;
}
.cat-btn {
  position: relative;
  background: var(--panel); color: var(--ink); font-weight: 600; padding: 13px 12px 13px 16px;
  border-radius: var(--radius-md); border: 1px solid var(--line); overflow: hidden;
  cursor: pointer; display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  gap: 3px; min-height: 64px; transition: transform .08s, border-color .15s, background .15s; text-align: left;
}
/* Kateqoriya rəngi yalnız sol kənarda nazik zolaq kimi — düymə özü neytraldır */
.cat-btn::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--kat, var(--faint)); }
.cat-btn:hover { border-color: var(--input-border); background: var(--panel-alt); }
.cat-btn:active { transform: scale(0.97); }
.cat-btn .name { font-size: 13.5px; text-align: left; }
.cat-btn .sub { font-size: 11px; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }

/* ---- "Ekranı düzənlə" rejimi: iPhone-dakı kimi yüngül titrəmə + silmə (−) nişanı ---- */
@keyframes kategoriJiggle {
  0% { transform: rotate(-1.3deg); }
  50% { transform: rotate(1.3deg); }
  100% { transform: rotate(-1.3deg); }
}
.cat-btn.duzenleme-jiggle { animation: kategoriJiggle 0.26s infinite ease-in-out; }
.cat-btn.siralanan-uçan { animation: none !important; z-index: 300; box-shadow: 0 10px 26px rgba(0,0,0,.55); transform: scale(1.08) !important; }
.cat-sil-badge {
  position: absolute; top: -7px; left: -7px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--danger); color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 800; line-height: 1; box-shadow: 0 2px 6px rgba(0,0,0,.5); z-index: 3; cursor: pointer;
}
.cat-edit-badge {
  position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--brand); color: var(--on-brand); display: flex; align-items: center; justify-content: center;
  font-size: 11px; line-height: 1; box-shadow: 0 2px 6px rgba(0,0,0,.5); z-index: 3; cursor: pointer;
}

/* Xərclər ekranı: günlük (tiksiz) və aylıq sabit (tikli) kateqoriyalar arasında xətt */
.grid-ayirici {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 10px;
  color: var(--muted); font-size: 11.5px; font-weight: 600; margin: 2px 0;
}
.grid-ayirici::before, .grid-ayirici::after { content: ''; flex: 1; height: 1px; background: var(--input-border); }

.dashed-btn {
  width: 100%; margin-bottom: 22px; border: 1.5px dashed var(--input-border); background: transparent;
  color: var(--muted); font-weight: 600; padding: 11px; border-radius: var(--radius-md);
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 13.5px;
}
.dashed-btn:hover { border-color: var(--brand-soft); color: var(--brand-ink); }

.history-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.history-head span { font-weight: 600; font-size: 14px; color: var(--ink); letter-spacing: 0.01em; }
.history-head button { font-size: 12px; color: var(--danger); background: none; border: none; cursor: pointer; font-weight: 600; }

.list-item {
  display: flex; justify-content: space-between; align-items: center; background: var(--panel);
  border: 1px solid var(--line); padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 7px;
}
.list-item .cat { font-weight: 600; color: var(--ink); }
.list-item .time { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }
.list-item .right { display: flex; align-items: center; gap: 10px; }
.list-item .amt { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.list-item button { color: var(--faint); background: none; border: none; cursor: pointer; font-size: 14px; display: flex; padding: 4px; border-radius: 8px; }
.list-item .right { gap: 6px; }
.list-item button:hover { background: var(--panel-alt); color: var(--ink); }
.list-item button.sil:hover { color: var(--danger); }
.empty-note { color: var(--muted); text-align: center; font-size: 13.5px; padding: 18px 0; margin: 0; }

/* ==== Brend: SM monoqram loqo + "SAFE MONEY" yazısı (v3.13) ====
   Şrift: Cormorant Garamond (SIL Open Font License, fonts/OFL.txt) — yalnız lazım olan hərflər, ~kiçik fayl. */
@font-face { font-family: "SM Brand"; src: url("../fonts/brand.woff") format("woff"); font-weight: 600; font-display: swap; }
.brand-logo { width: 30px; height: 30px; border-radius: 8px; display: block; }
.brand-logo-lg { width: 76px; height: 76px; border-radius: 19px; margin: 0 auto 16px; box-shadow: 0 10px 30px var(--shadow); }
.brand-wordmark { font-family: "SM Brand", Georgia, "Times New Roman", serif !important; font-size: 17px !important; font-weight: 600 !important; letter-spacing: 0.2em !important; text-transform: uppercase; color: var(--ink); margin: 0; line-height: 1; }
.brand-wordmark-lg { font-size: 22px !important; letter-spacing: 0.24em !important; margin-bottom: 10px !important; }

/* Xərclər ekranı: xərc hesabı seçimi */
.xerc-hesab-setir { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 10px; padding: 8px 10px 8px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.xerc-hesab-setir.deyisib { border-color: var(--brand-ink); }
.xh-lbl { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.xh-secim { flex: 1; min-width: 0; max-width: 62%; padding: 7px 10px; border: 1px solid var(--input-border); border-radius: 10px; font: inherit; font-size: 13.5px; font-weight: 600; background: var(--panel-alt, var(--panel)); color: var(--ink); text-align: right; }
.xh-ipucu { margin: -4px 2px 10px; font-size: 11.5px; color: var(--muted); line-height: 1.35; }
