:root {
  --bg: var(--tg-theme-bg-color, #17212b);
  --secondary-bg: var(--tg-theme-secondary-bg-color, #1c2733);
  --text: var(--tg-theme-text-color, #e7ecf3);
  --hint: var(--tg-theme-hint-color, #7d8b99);
  --link: var(--tg-theme-link-color, #6ab3f3);
  --button: var(--tg-theme-button-color, #5288c1);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --border: rgba(255, 255, 255, 0.08);
  --accent: #34d9a4;
  --warn: #ffb84d;
  --danger: #ff6b6b;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
}

#app { padding: 12px 14px 28px; max-width: 560px; margin: 0 auto; }

.loading, .error, .empty { text-align: center; color: var(--hint); padding: 40px 16px; }

h1, h2, h3 { margin: 0 0 8px; }
h1 { font-size: 19px; }
h2 { font-size: 16px; margin-top: 20px; }
p { margin: 4px 0; color: var(--hint); font-size: 13px; }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; overflow-x: auto; padding-bottom: 2px; }
.tab {
  padding: 8px 14px; border-radius: 999px; background: var(--secondary-bg);
  color: var(--hint); font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer;
  border: 1px solid transparent;
}
.tab.active { background: var(--button); color: var(--button-text); }

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

.rate-row { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 0; }
.rate-row .label { color: var(--hint); font-size: 13px; }
.rate-row .value { font-size: 17px; font-weight: 700; }

.btn {
  display: inline-block; width: 100%; text-align: center; padding: 11px 16px;
  border-radius: 10px; background: var(--button); color: var(--button-text);
  font-weight: 600; font-size: 14px; border: none; cursor: pointer; margin-top: 6px;
}
.btn.secondary { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn.small { width: auto; padding: 7px 12px; font-size: 13px; margin: 4px 4px 0 0; }
.btn:disabled { opacity: .5; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--hint); margin-bottom: 5px; font-weight: 600; }
.field input, .field select {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 14px;
}

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.pill.NEW { background: rgba(82,136,193,.18); color: var(--link); }
.pill.PAID { background: rgba(255,184,77,.18); color: var(--warn); }
.pill.COMPLETED { background: rgba(52,217,164,.18); color: var(--accent); }
.pill.CANCELED { background: rgba(255,107,107,.18); color: var(--danger); }

.req { border-bottom: 1px solid var(--border); padding: 10px 0; }
.req:last-child { border-bottom: none; }
.req .top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.req .id { font-weight: 700; }
.req .meta { font-size: 12px; color: var(--hint); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.stat { background: var(--secondary-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.stat .label { font-size: 11px; color: var(--hint); }
.stat .value { font-size: 18px; font-weight: 700; margin-top: 2px; }

.hint-box { font-size: 12px; color: var(--hint); background: var(--bg); border-radius: 8px; padding: 8px 10px; margin-top: 6px; }
