:root {
  --bg:        #101119;
  --card:      #191b25;
  --card-2:    #212433;
  --line:      #2c3042;
  --ink:       #eceef5;
  --ink-dim:   #9aa0b4;
  --accent:    #f0a868;
  --in:        #4ade80;
  --out:       #f87171;
  --radius:    14px;
  --shadow:    0 1px 3px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
}

body {
  font-family: "Vazirmatn", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  padding-bottom: 48px;
}

a { color: var(--accent); text-decoration: none; }

.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px; }

/* ---- header + tabs ---- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 0 10px;
}
.top h1 { font-size: 19px; margin: 0; font-weight: 600; }
.top .who { color: var(--ink-dim); font-size: 13px; }

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 14px;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: 0 0 auto;
  padding: 8px 15px;
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-dim);
  font-size: 14.5px;
  border: 1px solid transparent;
}
.tabs a.on { background: var(--card-2); color: var(--ink); border-color: var(--line); }

/* ---- cards ---- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card h2 {
  font-size: 14px;
  margin: 0 0 12px;
  color: var(--ink-dim);
  font-weight: 600;
  letter-spacing: .01em;
}
.empty { color: var(--ink-dim); text-align: center; padding: 26px 16px; }

/* ---- balance ---- */
.balance { text-align: center; padding: 22px 16px 18px; }
.balance .big {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -.01em;
  direction: ltr;
  unicode-bidi: isolate;
}
.balance .sub { color: var(--ink-dim); font-size: 13.5px; margin-top: 2px; }
.split { display: flex; gap: 10px; margin-top: 16px; }
.split > div {
  flex: 1;
  background: var(--card-2);
  border-radius: 10px;
  padding: 10px 8px;
}
.split .k { font-size: 12px; color: var(--ink-dim); }
.split .v { font-size: 17px; font-weight: 600; direction: ltr; unicode-bidi: isolate; }
.pos { color: var(--in); }
.neg { color: var(--out); }

/* ---- forms ---- */
input, textarea, select, button {
  font-family: inherit;
  font-size: 16px;
}
.field, textarea.field {
  width: 100%;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  padding: 12px 14px;
  outline: none;
}
.field:focus { border-color: var(--accent); }
.field::placeholder { color: #6b7288; }
textarea.field { resize: vertical; min-height: 84px; line-height: 1.6; }

.row { display: flex; gap: 8px; }
.row > * { min-width: 0; }

.btn {
  background: var(--accent);
  color: #23170a;
  border: 0;
  border-radius: 10px;
  padding: 12px 18px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn.ghost {
  background: var(--card-2);
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 500;
}
.btn:active { transform: translateY(1px); }
.hint { color: var(--ink-dim); font-size: 12.5px; margin-top: 8px; }

/* ---- lists ---- */
.list { margin: 0; padding: 0; list-style: none; }
.list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.list li:last-child { border-bottom: 0; }
.list .txt { flex: 1; min-width: 0; }
.list .ttl {
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list .meta { font-size: 12px; color: var(--ink-dim); }
.amt {
  font-weight: 600;
  font-size: 15.5px;
  direction: ltr;
  unicode-bidi: isolate;
  white-space: nowrap;
}
.x {
  background: none;
  border: 0;
  color: #5e6480;
  font-size: 19px;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}
.x:hover { color: var(--out); }

.note-body { white-space: pre-wrap; word-break: break-word; font-size: 15px; }
.note.done .note-body { color: var(--ink-dim); text-decoration: line-through; }
.tick {
  flex: 0 0 auto;
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 1.5px solid var(--line);
  background: var(--card-2);
  cursor: pointer;
  color: var(--in);
  font-size: 13px;
  line-height: 1;
  padding: 0;
}

/* ---- categories ---- */
.cats { display: flex; flex-direction: column; gap: 9px; }
.cat .cat-top { display: flex; justify-content: space-between; font-size: 14px; }
.cat .bar { height: 6px; background: var(--card-2); border-radius: 99px; margin-top: 5px; overflow: hidden; }
.cat .bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* ---- login ---- */
.login-wrap {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card { width: 100%; max-width: 320px; text-align: center; }
.login-card h1 { font-size: 22px; margin: 0 0 4px; }
.login-card p { color: var(--ink-dim); font-size: 14px; margin: 0 0 20px; }
.pin-input {
  width: 100%;
  text-align: center;
  letter-spacing: .5em;
  font-size: 26px;
  padding: 14px;
  direction: ltr;
}
.err { color: var(--out); font-size: 14px; margin-top: 12px; }

/* ---- toast ---- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(20px);
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 14.5px;
  box-shadow: 0 6px 20px rgba(0,0,0,.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
  z-index: 50;
  max-width: 88vw;
  text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { border-color: var(--out); }

.foot { text-align: center; color: #565c73; font-size: 12px; padding: 18px 0 8px; }
