@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: dark;
  --bg: #0c0d0f;
  --card: #17191c;
  --card-2: #1c1e22;
  --card-border: #26282c;
  --text: #f2f3f4;
  --text-dim: #8d9096;
  --text-faint: #55585e;
  --accent: #22b573;
  --accent-strong: #1a9a60;
  --accent-soft: rgba(34,181,115,0.14);
  --green: #22b573;
  --green-soft: rgba(34,181,115,0.14);
  --red: #e5484d;
  --red-soft: rgba(229,72,77,0.14);
  --radius: 14px;
  --radius-sm: 10px;
  font-synthesis: none;
}

* { box-sizing: border-box; }
*::selection { background: var(--accent); color: white; }

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

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 48px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

::placeholder { color: var(--text-faint); }

/* ---------- Topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg);
  border-bottom: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar .brand-row { display: flex; align-items: center; gap: 10px; }
.topbar .mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: #06180f;
}
.topbar .brand { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.topbar .user-name { font-size: 12px; color: var(--text-dim); margin-top: 1px; }
.topbar form { margin: 0; }

.topbar label.menu-btn {
  display: inline-flex;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
}
.topbar label.menu-btn:active { opacity: 0.75; }

/* ---------- Side drawer (slide-out menu) ---------- */

.drawer-checkbox { position: absolute; opacity: 0; pointer-events: none; }

.drawer-overlay {
  display: block;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 29;
}

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 80%;
  max-width: 320px;
  background: var(--card);
  border-left: 1px solid var(--card-border);
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.32,.72,.35,1);
  z-index: 30;
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow-y: auto;
}

.drawer-checkbox:checked ~ .drawer-overlay {
  opacity: 1;
  pointer-events: auto;
}
.drawer-checkbox:checked ~ .drawer {
  transform: translateX(0);
}

.drawer-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

.drawer-links { display: flex; flex-direction: column; gap: 4px; }
.drawer-links a {
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  background: transparent;
}
.drawer-links a:active { background: var(--card-2); }
.drawer-links a.active {
  background: var(--accent);
  color: #06180f;
  font-weight: 700;
}

.drawer-divider {
  height: 1px;
  background: var(--card-border);
  margin: 14px 0;
}

.drawer-footer { margin-top: auto; }
.drawer-footer form { margin: 0; }

.quick-actions { display: flex; gap: 10px; margin-top: 14px; }
.quick-actions a {
  flex: 1;
  text-align: center;
  padding: 13px 8px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
}
.quick-actions a:active { background: rgba(255,255,255,0.1); }

.section-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  margin-top: 2px;
}

/* ---------- Layout ---------- */

.container {
  max-width: 560px;
  margin: 0 auto;
  padding: 18px 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
}

.card h2 {
  margin: 0 0 14px;
  font-size: 15px;
  color: var(--text);
  font-weight: 700;
}

/* Balance card */
.card.hero {
  background: var(--card-2);
}

.balance {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.balance.negative { color: var(--red); }
.balance small { font-size: 15px; color: var(--text-dim); font-weight: 500; }

.balance-sub {
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 8px;
}

/* ---------- Forms ---------- */

label { display: block; font-size: 13px; font-weight: 500; color: var(--text-dim); margin: 12px 0 6px; }

input[type=text], input[type=number], input[type=date], input[type=password], select, textarea {
  width: 100%;
  padding: 13px 14px;
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  transition: border-color .12s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}
input[type=date] {
  min-width: 0;
}
input[type=date]::-webkit-calendar-picker-indicator {
  filter: invert(0.6);
  cursor: pointer;
}
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5.5 8L10 12.5L14.5 8' stroke='%238d9096' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--accent);
  color: #06180f;
  border: none;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  margin-top: 14px;
  text-align: center;
}
.btn:active { background: var(--accent-strong); }

.btn.secondary {
  background: var(--card-2);
  color: var(--text);
  border: 1px solid var(--card-border);
}
.btn.secondary:active { background: var(--card-border); }

.btn.small { padding: 9px 13px; font-size: 13px; margin-top: 0; border-radius: 8px; }
.btn.full { display: flex; width: 100%; }
.btn.danger { background: var(--red); color: white; }

/* ---------- Utility layout ---------- */

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1; min-width: 140px; }

/* ---------- Lists ---------- */

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid var(--card-border);
  gap: 10px;
}
.list-item:last-child { border-bottom: none; }
.list-item .meta { color: var(--text-dim); font-size: 12.5px; margin-top: 2px; }
.list-item .amount { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.list-item .amount.plus { color: var(--green); }
.list-item .amount.minus { color: var(--text); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--card-2);
  color: var(--text-dim);
}

.empty {
  color: var(--text-faint);
  font-size: 13.5px;
  padding: 18px 0;
  text-align: center;
}

.notice {
  background: var(--card-2);
  border: 1px solid var(--card-border);
  border-left: 3px solid var(--accent);
  color: var(--text);
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13.5px;
  line-height: 1.55;
}
.notice.error {
  border-left-color: var(--red);
}
.notice code {
  background: rgba(255,255,255,0.09);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 12.5px;
}

/* ---------- Headings ---------- */

h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 4px 0 16px;
}

/* ---------- User link cards ---------- */

.user-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  margin-bottom: 10px;
}
.user-link:active { background: var(--card-2); }
.user-link .who { display: flex; align-items: center; gap: 12px; }
.user-link .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.user-link .name { font-weight: 600; font-size: 14.5px; }

/* ---------- Login ---------- */

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-box { width: 100%; max-width: 340px; padding: 32px 26px; }
.login-box .mark-lg {
  width: 48px; height: 48px; border-radius: 13px; margin: 0 auto 18px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  font-weight: 800;
  color: #06180f;
}
.login-box h1 { text-align: center; font-size: 19px; margin-bottom: 24px; }
