:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #111111);
  --hint: var(--tg-theme-hint-color, #777777);
  --link: var(--tg-theme-link-color, #2481cc);
  --btn: var(--tg-theme-button-color, #2481cc);
  --btn-text: var(--tg-theme-button-text-color, #ffffff);
  --secondary: var(--tg-theme-secondary-bg-color, #f2f2f5);
  --destructive: var(--tg-theme-destructive-text-color, #e53935);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}
#app { max-width: 480px; margin: 0 auto; padding: 12px 12px 28px; }
.hidden { display: none !important; }
.banner {
  background: #fff3cd;
  color: #664d03;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 14px;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #222;
  color: #fff;
  padding: 10px 16px;
  border-radius: 24px;
  font-size: 14px;
  z-index: 50;
  max-width: 88vw;
  text-align: center;
}
.head { display: flex; justify-content: space-between; align-items: flex-start; margin: 4px 2px 12px; }
.hello { font-size: 20px; font-weight: 700; }
.sub { color: var(--hint); font-size: 13px; margin-top: 2px; }
.live { font-size: 13px; color: var(--hint); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #34c759; display: inline-block; }
.tabs {
  display: flex;
  gap: 6px;
  background: var(--secondary);
  border-radius: 14px;
  padding: 4px;
  margin-bottom: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.tab {
  flex: 1;
  border: 0;
  border-radius: 10px;
  padding: 9px 0;
  background: transparent;
  color: var(--hint);
  font-size: 13px;
  font-weight: 600;
}
.tab.sel { background: var(--bg); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,0.12); }
.card {
  background: var(--secondary);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 12px;
}
.card-title { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 16px; margin-bottom: 10px; }
.mini-btn {
  border: 0;
  background: var(--bg);
  color: var(--link);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
}
.mini-btn.big { padding: 10px 14px; font-size: 14px; }
.row-btns { display: flex; gap: 8px; margin: 10px 0 4px; flex-wrap: wrap; }
.stock-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stock-card {
  background: var(--bg);
  border-radius: 14px;
  padding: 10px 8px;
  text-align: center;
  border: 2px solid transparent;
}
.stock-card.sel { border-color: var(--link); }
.stock-card .nm { font-size: 12px; color: var(--hint); }
.stock-card .num { font-size: 26px; font-weight: 800; margin: 4px 0 2px; line-height: 1.1; }
.stock-card .meta { font-size: 11px; color: var(--hint); min-height: 26px; }
.stock-card .sisa { font-size: 12px; margin-top: 4px; }
.stock-card .st { font-size: 11px; margin-top: 6px; }
.stock-card .st.ok { color: #34c759; }
.stock-card .st.warn { color: #ff9500; }
.stock-card .st.bad { color: var(--destructive); }
.hint { font-size: 12px; color: var(--hint); margin-top: 8px; line-height: 1.4; }
.label { font-size: 13px; font-weight: 600; margin: 10px 0 6px; }
.muted { color: var(--hint); font-weight: 400; }
.chips { display: flex; gap: 8px; }
.chips.wrap { flex-wrap: wrap; }
.chip {
  flex: 1;
  border: 0;
  border-radius: 12px;
  padding: 10px 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}
.chip.sm { flex: none; padding: 7px 12px; font-size: 12px; }
.chip.sel { background: var(--btn); color: var(--btn-text); }
.chip:disabled { opacity: 0.45; }
.seg { display: flex; gap: 6px; background: var(--bg); border-radius: 12px; padding: 4px; }
.seg-btn {
  flex: 1;
  border: 0;
  border-radius: 9px;
  padding: 9px 0;
  background: transparent;
  color: var(--hint);
  font-size: 14px;
  font-weight: 600;
}
.seg-btn.sel { background: var(--btn); color: var(--btn-text); }
textarea, input[type="text"], input[type="number"], input[type="date"], select {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 11px 12px;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
}
textarea { resize: vertical; line-height: 1.5; }
.file-btn {
  display: block;
  text-align: center;
  background: var(--bg);
  color: var(--link);
  border-radius: 12px;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
}
.nik-info { font-size: 13px; color: var(--hint); margin-top: 6px; }
.nik-info.good { color: #34c759; }
.row { display: flex; gap: 10px; }
.row .field { flex: 1; }
.big-btn {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 14px;
  margin-top: 14px;
  background: var(--btn);
  color: var(--btn-text);
  font-size: 17px;
  font-weight: 700;
}
.big-btn:disabled { opacity: 0.45; }
.danger-btn {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 12px;
  margin-top: 12px;
  background: var(--bg);
  color: var(--destructive);
  font-size: 15px;
  font-weight: 700;
}
.bar { height: 14px; background: var(--bg); border-radius: 8px; overflow: hidden; }
#barFill { height: 100%; width: 0%; background: #34c759; transition: width 0.4s; }
.big-line { font-size: 17px; font-weight: 700; margin: 10px 0 2px; }
.step-line { font-size: 13px; color: var(--hint); margin-bottom: 10px; line-height: 1.4; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; font-size: 12px; color: var(--hint); }
.stats b { font-size: 18px; color: var(--text); }
.cur { font-size: 14px; margin-top: 8px; }
.badge { font-size: 12px; background: var(--bg); padding: 4px 10px; border-radius: 20px; font-weight: 600; }
.badge.ok { color: #34c759; }
.badge.skip { color: #ff9500; }
.badge.fail { color: var(--destructive); }
.hist { font-size: 14px; }
.hist .row-line { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--bg); gap: 8px; }
.hist .row-line:last-child { border-bottom: 0; }
.hist .nik { font-family: ui-monospace, monospace; font-size: 13px; }
.hist .ok { color: #34c759; }
.hist .skip { color: #ff9500; }
.hist .fail { color: var(--destructive); }
.hist .time { color: var(--hint); font-size: 12px; white-space: nowrap; }
.info ul { margin: 4px 0 0; padding-left: 18px; font-size: 14px; line-height: 1.6; color: var(--hint); }
.table-wrap { overflow-x: auto; margin-top: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--hint); font-size: 12px; padding: 6px 4px; border-bottom: 1px solid var(--bg); }
td { padding: 8px 4px; border-bottom: 1px solid var(--bg); vertical-align: middle; }
td.nik { font-family: ui-monospace, monospace; }
td.tap { cursor: pointer; }
tr.detail-row td.detail { font-size: 12px; color: var(--hint); line-height: 1.5; background: var(--bg); border-radius: 8px; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--btn); }
