/* FinanceNMT – dark grey surface, white text, dark purple accents */
:root {
  --bg: #1f2124;
  --bg-soft: #26282c;
  --card: #2a2d31;
  --card-2: #31343a;
  --line: #3a3e45;
  --text: #ffffff;
  --muted: #a9adb6;
  --purple: #4c1d95;
  --purple-500: #6d28d9;
  --purple-300: #a78bfa;
  --danger: #b91c1c;
  --ok: #15803d;
  --warn: #b45309;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { -webkit-tap-highlight-color: transparent; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  min-height: 100%;
  overscroll-behavior-y: none;
}

body {
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  -webkit-user-select: none;
  user-select: none;
}
input, textarea, select { -webkit-user-select: text; user-select: text; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.card-2 { background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  background: var(--purple); color: #fff; border: none; border-radius: 12px;
  padding: .75rem 1rem; font-weight: 600; font-size: .95rem; cursor: pointer;
  transition: background .15s ease, transform .1s ease;
}
.btn:hover { background: var(--purple-500); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn-ghost:hover { background: var(--card-2); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: .45rem .7rem; font-size: .8rem; border-radius: 10px; }

.input, .select, .textarea {
  width: 100%; background: var(--bg-soft); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px;
  padding: .7rem .85rem; font-size: 1rem; outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--purple-300); }
.input::placeholder, .textarea::placeholder { color: #767b85; }
.label { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .35rem; font-weight: 600; }

.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .6rem; border-radius: 999px; font-size: .7rem; font-weight: 700; letter-spacing: .04em; }
.chip-purple { background: rgba(109, 40, 217, .22); color: var(--purple-300); }
.chip-red { background: rgba(185, 28, 28, .22); color: #fca5a5; }
.chip-green { background: rgba(21, 128, 61, .22); color: #86efac; }
.chip-amber { background: rgba(180, 83, 9, .22); color: #fcd34d; }
.chip-grey { background: rgba(255, 255, 255, .08); color: var(--muted); }

.money { font-variant-numeric: tabular-nums; }
.pos { color: #86efac; }
.neg { color: #fca5a5; }

table.data { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.data th { text-align: left; color: var(--muted); font-weight: 600; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; padding: .55rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: .6rem; border-bottom: 1px solid rgba(58,62,69,.6); vertical-align: top; }
table.data tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.view-enter { animation: fade .18s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

#toasts { position: fixed; left: 0; right: 0; bottom: calc(1rem + var(--safe-bottom)); display: flex; flex-direction: column; align-items: center; gap: .5rem; z-index: 90; pointer-events: none; padding: 0 1rem; }
.toast { pointer-events: auto; max-width: 32rem; width: 100%; background: var(--card-2); border: 1px solid var(--line); border-left: 4px solid var(--purple-500); border-radius: 12px; padding: .75rem .9rem; font-size: .875rem; box-shadow: 0 10px 30px rgba(0,0,0,.45); animation: fade .18s ease both; }
.toast.err { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.72); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 100; backdrop-filter: blur(2px); }
.modal { width: 100%; max-width: 30rem; max-height: 88vh; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 1.25rem; animation: fade .18s ease both; }

.skeleton { background: linear-gradient(90deg, var(--card) 25%, var(--card-2) 50%, var(--card) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 12px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.line-item { border: 1px solid var(--line); border-radius: 12px; padding: .75rem; background: var(--bg-soft); }

.nav-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
@media (min-width: 640px) { .nav-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: .85rem; }
.stat .k { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.stat .v { font-size: 1.35rem; font-weight: 800; margin-top: .2rem; font-variant-numeric: tabular-nums; }
