/* Telegram mavzusi: ranglar Telegram'dan keladi (yorug' / tungi), brauzerda — zaxira qiymatlar */
:root {
  --bg: var(--tg-theme-secondary-bg-color, #efeff4);
  --section: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #ffffff));
  --text: var(--tg-theme-text-color, #000000);
  --hint: var(--tg-theme-hint-color, #8e8e93);
  --link: var(--tg-theme-link-color, #2481cc);
  --accent: var(--tg-theme-accent-text-color, var(--link));
  --header: var(--tg-theme-section-header-text-color, var(--hint));
  --subtitle: var(--tg-theme-subtitle-text-color, var(--hint));
  --button: var(--tg-theme-button-color, #2481cc);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --destructive: var(--tg-theme-destructive-text-color, #e53935);
  --separator: var(--tg-theme-section-separator-color, color-mix(in srgb, var(--hint) 25%, transparent));
  --green: #31b545;
  --radius: 12px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 560px; margin: 0 auto; padding: 12px 16px calc(84px + env(safe-area-inset-bottom)); }
.status { text-align: center; color: var(--hint); padding: 40px 0; }

h1 { font-size: 22px; font-weight: 700; margin: 8px 4px 16px; }
.section-title { margin: 20px 16px 6px; color: var(--header); font-size: 13px; font-weight: 500; text-transform: uppercase; letter-spacing: .02em; }
.footnote { margin: 6px 16px 0; color: var(--hint); font-size: 13px; white-space: pre-line; }

/* Bo'lim (section): yumaloq oq blok, ichida qatorlar */
.section { background: var(--section); border-radius: var(--radius); overflow: hidden; }
.cell {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 48px; padding: 10px 16px;
  border: none; background: none; color: inherit; font: inherit; text-align: left;
  position: relative;
}
.cell + .cell::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 0.5px solid var(--separator); }
.cell.with-icon + .cell.with-icon::before { left: 60px; }
button.cell { cursor: pointer; }
button.cell:active { background: color-mix(in srgb, var(--hint) 12%, transparent); }
.cell .icon {
  flex: 0 0 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center; font-size: 18px;
  background: color-mix(in srgb, var(--button) 14%, transparent);
}
.cell .body { flex: 1; min-width: 0; }
.cell .title { overflow: hidden; text-overflow: ellipsis; }
.cell .subtitle { color: var(--subtitle); font-size: 14px; margin-top: 1px; }
.cell .after { text-align: right; color: var(--hint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cell .chevron { color: var(--hint); font-size: 20px; line-height: 1; }
.pos { color: var(--green) !important; }
.neg { color: var(--destructive) !important; }

/* Balans kartasi */
.balance { padding: 16px; }
.balance .label { color: var(--hint); font-size: 14px; }
.balance .amount { font-size: 30px; font-weight: 700; margin: 2px 0; font-variant-numeric: tabular-nums; }
.balance .extra { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.balance .due { margin-top: 6px; font-size: 14px; color: var(--subtitle); }
.balance .ok { font-size: 20px; font-weight: 600; }

.chip { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 500; }
.chip.new { background: color-mix(in srgb, var(--button) 15%, transparent); color: var(--accent); }
.chip.done { background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--green); }
.chip.rejected { background: color-mix(in srgb, var(--destructive) 15%, transparent); color: var(--destructive); }

/* Forma: Telegram'dagi kabi bo'lim ichidagi maydonlar */
.field { display: block; padding: 8px 16px 10px; position: relative; }
.field + .field::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 0.5px solid var(--separator); }
.field span { display: block; color: var(--hint); font-size: 13px; }
.field input {
  display: block; width: 100%; padding: 4px 0 0; border: none; outline: none;
  background: transparent; color: var(--text); font: inherit; font-size: 17px;
}
.field input[inputmode="decimal"] { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.error { margin: 10px 16px 0; color: var(--destructive); font-size: 14px; }
.main-button {
  display: block; width: 100%; margin-top: 16px; padding: 14px;
  border: none; border-radius: var(--radius);
  background: var(--button); color: var(--button-text); font: inherit; font-weight: 600;
}
.main-button:disabled { opacity: .6; }
.empty { padding: 16px; color: var(--hint); text-align: center; }
.link { color: var(--link); background: none; border: none; font: inherit; padding: 0; cursor: pointer; }

/* Pastki tablar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: center;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--section);
  border-top: 0.5px solid var(--separator);
}
.tabbar button {
  flex: 1; max-width: 160px; padding: 4px 0;
  border: none; background: none; color: var(--hint); font: inherit; font-size: 11px; font-weight: 500;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tabbar button .tab-icon { font-size: 22px; line-height: 1; filter: grayscale(1); opacity: .7; }
.tabbar button.active { color: var(--accent); }
.tabbar button.active .tab-icon { filter: none; opacity: 1; }
