:root {
  --bg: #e4dfd3;
  --paper: #fbf9f4;
  --ink: #1b1b1b;
  --accent: #b42318;
  --ink-soft: #6b6b63;
  --line: #c9c3b4;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Mono", monospace;
  -webkit-tap-highlight-color: transparent;
}

body {
  padding: 16px 12px 40px;
}

.app {
  max-width: 480px;
  margin: 0 auto;
}

h1, h2, h3 {
  margin: 0;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

h1 { font-size: 15px; }
h2 { font-size: 13px; }
h3 { font-size: 12px; color: var(--ink-soft); }

p { margin: 0; }

.hidden { display: none !important; }

/* chek qog'ozi kartasi */
.receipt {
  position: relative;
  background: var(--paper);
  padding: 20px 18px 24px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.04), 0 8px 20px rgba(0,0,0,0.06);
  margin-bottom: 18px;
}

.receipt::after {
  content: "";
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  bottom: -13px;
  height: 14px;
  background-image:
    linear-gradient(-45deg, var(--bg) 7px, transparent 0),
    linear-gradient(45deg, var(--bg) 7px, transparent 0);
  background-size: 14px 14px;
  background-repeat: repeat-x;
  background-position: left bottom;
}

.divider {
  border: none;
  border-top: 1.5px dashed var(--line);
  margin: 16px 0;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 7px 0;
}

.row .label { color: var(--ink-soft); font-size: 12px; }
.row .value { font-weight: 500; font-size: 13px; text-align: right; }

.balance {
  font-size: 52px;
  font-weight: 700;
  line-height: 1;
  margin: 6px 0 2px;
  letter-spacing: -0.01em;
}

.balance-unit {
  font-size: 13px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.stamp {
  display: inline-block;
  border: 2px solid var(--accent);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 3px 10px;
  transform: rotate(-3deg);
}

.stamp.muted {
  border-color: var(--ink-soft);
  color: var(--ink-soft);
}

button, .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 56px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: 0;
  border: 2px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  margin-bottom: 10px;
  padding: 0 14px;
}

button:active { opacity: 0.8; }
button:disabled { opacity: 0.4; cursor: default; }

button.secondary {
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--ink);
}

button.danger {
  background: var(--paper);
  color: var(--accent);
  border: 2px solid var(--accent);
}

button.ghost {
  background: transparent;
  border: none;
  min-height: auto;
  padding: 6px 0;
  color: var(--ink-soft);
  font-weight: 500;
}

.btn-row {
  display: flex;
  gap: 10px;
}
.btn-row > * { flex: 1; margin-bottom: 0; }

input, select {
  width: 100%;
  min-height: 48px;
  font-family: inherit;
  font-size: 15px;
  padding: 0 12px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  margin-bottom: 12px;
}
input:focus, select:focus { outline: none; border-color: var(--ink); }

label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.field { margin-bottom: 14px; }

.phone-input { display: flex; align-items: center; gap: 8px; }
.phone-prefix { font-size: 15px; font-weight: 700; white-space: nowrap; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.tab {
  flex: 1 1 auto;
  min-width: 70px;
  text-align: center;
  padding: 8px 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--ink-soft);
  cursor: pointer;
}
.tab.active { border-color: var(--ink); color: var(--ink); background: var(--bg); }

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
  gap: 10px;
}
.list-item:last-child { border-bottom: none; }

.list-item .meta { font-size: 11px; color: var(--ink-soft); }
.list-item .main { font-size: 13px; font-weight: 500; }
.list-item .amount { font-weight: 700; font-size: 14px; white-space: nowrap; }
.amount.plus { color: var(--ink); }
.amount.minus { color: var(--accent); }

.month-header {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  margin: 14px 0 4px;
  display: flex;
  justify-content: space-between;
}

.icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
}

.toast {
  position: fixed;
  left: 12px;
  right: 12px;
  top: 12px;
  max-width: 456px;
  margin: 0 auto;
  background: var(--ink);
  color: var(--paper);
  padding: 14px 16px;
  font-size: 12px;
  cursor: pointer;
  transition: top 0.15s ease;
  z-index: 50;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}
.toast.error { background: var(--accent); }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(27,27,27,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 40;
}

.overlay .receipt { width: 100%; max-width: 360px; margin-bottom: 0; }

.center { text-align: center; }
.muted { color: var(--ink-soft); font-size: 12px; }
.mt { margin-top: 14px; }

.qr-img {
  width: 100%;
  max-width: 260px;
  margin: 0 auto 10px;
  display: block;
  background: var(--paper);
  padding: 10px;
}

.spinner-text {
  text-align: center;
  padding: 60px 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 12px;
  color: var(--ink-soft);
}
