:root {
  --staff-bg: var(--tg-theme-secondary-bg-color, #f4f7fb);
  --staff-card: var(--tg-theme-bg-color, #fff);
  --staff-text: var(--tg-theme-text-color, #101b33);
  --staff-muted: var(--tg-theme-hint-color, #77839a);
  --staff-line: color-mix(in srgb, var(--staff-text) 10%, transparent);
  --staff-accent: var(--tg-theme-button-color, #2c7eea);
  --staff-accent-text: var(--tg-theme-button-text-color, #fff);
  --staff-danger: #ef5350;
  --staff-success: #24ad5f;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; height: auto !important; overflow: auto !important; }
body.staff-app {
  margin: 0;
  padding: max(96px, calc(72px + env(safe-area-inset-top))) 14px max(76px, calc(58px + env(safe-area-inset-bottom)));
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: var(--tg-viewport-stable-height, 100dvh);
  background: var(--staff-bg);
  color: var(--staff-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.staff-app .brand-logo { display: none !important; }
.staff-app .brand-footer {
  position: fixed;
  z-index: 5;
  left: 16px;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0;
  color: var(--staff-muted);
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
  opacity: .72;
}
.lunar-image-logo { position: relative; display: block; flex: 0 0 auto; overflow: hidden; }
.lunar-image-logo img {
  position: absolute;
  left: 0;
  top: 50%;
  display: block;
  width: 100%;
  height: auto;
  transform: translateY(-50%);
}
.lunar-image-logo .logo-light { display: block; }
.lunar-image-logo .logo-dark { display: none; }
.brand-footer .lunar-image-logo { width: 48px; height: 15px; }
.staff-app .container {
  width: min(100%, 440px);
  max-width: 440px;
  max-height: none;
  margin: auto;
  padding: 0;
  transition: opacity .3s ease, transform .3s ease;
}
.staff-header { margin: 6px 4px 22px; }
.staff-header-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.staff-kicker {
  margin: 0 0 7px;
  color: var(--staff-accent);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.staff-app h1 {
  margin: 0;
  color: var(--staff-text);
  font-size: 28px;
  line-height: 1.08;
  letter-spacing: -.035em;
  text-align: left;
}
.staff-subtitle { margin: 8px 0 0; color: var(--staff-muted); font-size: 13px; line-height: 1.45; }
.staff-ready {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid var(--staff-line);
  border-radius: 999px;
  background: var(--staff-card);
  color: var(--staff-muted);
  font-size: 11px;
  font-weight: 650;
}
.staff-ready::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--staff-success); }
.staff-panel, .staff-app .card {
  padding: 18px;
  border: 1px solid var(--staff-line);
  border-radius: 20px;
  background: var(--staff-card);
  box-shadow: 0 8px 30px rgba(24, 48, 86, .055);
}
.staff-app .operation-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 0 0 20px;
  padding: 4px;
  border-radius: 14px;
  background: var(--staff-bg);
}
.staff-app .operation-btn {
  padding: 12px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--staff-muted);
  font-size: 14px;
  font-weight: 700;
  transition: background .2s ease, color .2s ease, box-shadow .2s ease;
}
.staff-app .operation-btn.active {
  background: var(--staff-card);
  color: var(--staff-text);
  box-shadow: 0 3px 12px rgba(22, 42, 75, .08);
}
.staff-app .operation-btn[data-operation="deduct"].active { color: var(--staff-danger); }
.staff-app .form-group { margin: 0 0 14px; }
.staff-app label { margin: 0 0 8px; color: var(--staff-muted); font-size: 12px; font-weight: 650; }
.staff-app .amount-field { position: relative; }
.staff-app .amount-field::after {
  content: "вор.";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--staff-muted);
  font-size: 13px;
  pointer-events: none;
}
.staff-app input[type="number"] {
  width: 100%;
  height: 64px;
  padding: 0 70px 0 16px;
  border: 1px solid var(--staff-line);
  border-radius: 14px;
  background: var(--staff-card);
  color: var(--staff-text);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.03em;
  outline: 0;
  appearance: textfield;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.staff-app input[type="number"]:focus { border-color: var(--staff-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--staff-accent) 13%, transparent); }
.quick-amounts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin: 0 0 14px; }
.staff-app .quick-amount {
  min-height: 38px;
  padding: 0 6px;
  border: 1px solid var(--staff-line);
  border-radius: 10px;
  background: var(--staff-card);
  color: var(--staff-text);
  font-size: 13px;
}
.staff-app button {
  width: 100%;
  min-height: 50px;
  padding: 0 16px;
  border: 0;
  border-radius: 13px;
  background: var(--staff-accent);
  color: var(--staff-accent-text);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease;
}
.staff-app button:active { transform: scale(.985); }
.staff-app button:disabled { opacity: .4; cursor: default; }
.staff-app button.secondary { background: var(--staff-bg); color: var(--staff-text); }
.staff-app .hidden { display: none !important; }
.staff-app #amountInputSection, .staff-app #scanSection { animation: staff-in .25s cubic-bezier(.2,.8,.2,1); }
.staff-app .amount-display {
  margin: 0 0 16px;
  padding: 18px;
  border-radius: 15px;
  background: var(--staff-bg);
  color: var(--staff-muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.8;
  text-align: left;
}
.staff-app #amountValue { color: var(--staff-text); font-size: 25px; font-weight: 750; letter-spacing: -.03em; }
.staff-app .status {
  min-height: 0;
  margin: 12px 0 0;
  padding: 12px 14px;
  border: 0;
  border-radius: 12px;
  background: var(--staff-bg);
  color: var(--staff-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  text-align: center;
}
.staff-app .status.success { background: color-mix(in srgb, var(--staff-success) 9%, var(--staff-card)); color: var(--staff-success); }
.staff-app .status.error { background: color-mix(in srgb, var(--staff-danger) 9%, var(--staff-card)); color: var(--staff-danger); }
.staff-accredit .container { display: block; }
.staff-accredit .card:first-child { padding: 0; border: 0; background: transparent; box-shadow: none; }
.staff-accredit .card.row { gap: 12px; }
.staff-accredit .count {
  display: flex;
  justify-content: space-between;
  padding: 0 2px 14px;
  border-bottom: 1px solid var(--staff-line);
  color: var(--staff-muted);
  font-size: 13px;
  text-align: left;
}
.staff-accredit .count span { color: var(--staff-text); font-size: 17px; font-weight: 750; }
.staff-accredit #scanBtn { min-height: 62px; }
@keyframes staff-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.staff-loader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: var(--staff-bg);
  opacity: 1;
  visibility: visible;
  transition: opacity .32s ease, visibility .32s ease;
}
.staff-loader-inner { display: grid; justify-items: center; gap: 18px; }
.staff-loader-logo { width: 132px; height: 40px; }
.staff-loader-ring {
  width: 24px;
  height: 24px;
  border: 2px solid color-mix(in srgb, var(--staff-muted) 22%, transparent);
  border-top-color: var(--staff-accent);
  border-radius: 50%;
  animation: staff-spin .75s linear infinite;
}
.staff-app:not(.is-loading) .staff-loader { opacity: 0; visibility: hidden; pointer-events: none; }
.staff-app.is-loading .container, .staff-app.is-loading .brand-footer { opacity: 0; transform: translateY(5px); }
@keyframes staff-spin { to { transform: rotate(360deg); } }
@media (prefers-color-scheme: dark) {
  :root { --staff-line: rgba(255,255,255,.1); }
  .staff-panel, .staff-app .card { box-shadow: none; }
  .lunar-image-logo .logo-light { display: none; }
  .lunar-image-logo .logo-dark { display: block; }
}
@media (max-width: 360px) {
  body.staff-app { padding-left: 10px; padding-right: 10px; }
  .staff-panel, .staff-app .card { padding: 15px; border-radius: 17px; }
  .staff-app h1 { font-size: 25px; }
  .quick-amounts { gap: 5px; }
}
@media (max-height: 650px) {
  body.staff-app { align-items: flex-start; padding-top: max(82px, calc(64px + env(safe-area-inset-top))); }
}
@media (prefers-reduced-motion: reduce) {
  .staff-loader-ring { animation-duration: 1.4s; }
  .staff-loader, .staff-app .container { transition: none; }
}
