:root {
  --ink: #17241e;
  --forest: #102820;
  --forest-2: #1b3f34;
  --pine: #1f6a52;
  --paper: #f4efe4;
  --paper-2: #fffaf3;
  --gold: #a97832;
  --gold-2: #e4c48a;
  --coral: #9d3b32;
  --amber: #8a5a12;
  --line: rgba(23, 36, 30, 0.12);
  --shadow: 0 24px 60px rgba(6, 16, 12, 0.28);
  color-scheme: light;
  font-family: Manrope, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { color: var(--paper); background: var(--forest); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }

.stage {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(228, 196, 138, 0.2), transparent 55%),
    radial-gradient(700px 500px at 100% 0%, rgba(31, 106, 82, 0.55), transparent 50%),
    var(--forest);
}

.phone {
  width: min(440px, 100%);
  min-height: 720px;
  background: var(--paper);
  color: var(--ink);
  border-radius: 32px;
  box-shadow: var(--shadow);
  overflow: auto;
  position: relative;
  display: flex;
  flex-direction: column;
}
.site-head {
  background: #fff;
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--line);
  display: grid;
  justify-items: center;
  gap: 8px;
}
.site-head .logo { height: 26px; width: auto; }
.promo-kicker {
  margin: 0;
  color: #1c7777;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 800;
}
.phone h1, .phone h2 { font-family: Manrope, sans-serif; font-weight: 800; }
.foot { margin-top: auto; padding: 6px 20px 18px; text-align: center; }
.foot a { color: #1c7777; font-weight: 800; font-size: 14px; text-decoration: none; }
.foot a:hover { text-decoration: underline; }

.screen { display: none; padding: 22px 20px 12px; }
.screen.on { display: block; }
#home.screen.on { display: flex; flex-direction: column; flex: 1; }
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.top:has(h2) { display: grid; grid-template-columns: 1fr auto 1fr; }
.top:has(h2) .back { justify-self: start; }
.top:has(h2) h2 { margin: 0; text-align: center; font-size: 22px; }
.top.home-top { justify-content: space-between; align-items: center; margin-bottom: 14px; }
.account { margin: 0; display: grid; gap: 2px; min-width: 0; }
.account span { color: rgba(23, 36, 30, 0.55); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.account b { font-size: 18px; font-weight: 800; }
.eyebrow {
  margin: 0;
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}
h1, h2, h3 { font-family: Unbounded, Manrope, sans-serif; font-weight: 500; letter-spacing: -0.03em; }
h1 { font-size: 28px; line-height: 1.15; margin: 4px 0 0; }
h2 { font-size: 26px; margin: 0 0 8px; }
.lede { margin: 8px 0 0; color: rgba(23, 36, 30, 0.72); line-height: 1.45; }
.back, .text-btn, .ghost {
  border: 0; background: transparent; color: var(--pine); font-weight: 700; padding: 8px 0;
}
.back {
  width: 40px; height: 40px; padding: 0; display: grid; place-items: center; justify-self: start;
}
.back svg { display: block; }
.stack { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 700; }
label.check { display: flex; align-items: center; gap: 8px; }
label.check input { width: auto; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--ink);
  border-radius: 14px;
  padding: 14px 14px;
  outline: none;
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--pine); box-shadow: 0 0 0 4px rgba(31, 106, 82, 0.12); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.primary, .secondary {
  border: 0; border-radius: 16px; padding: 15px 16px; font-weight: 750;
}
.primary { background: var(--forest); color: var(--paper); }
a.primary { display: block; text-align: center; text-decoration: none; }
.auth-stack { margin-top: 18px; }
.auth-choices { display: grid; gap: 10px; }
.login-btn {
  display: flex; align-items: center; gap: 12px; width: 100%;
  border: 0; background: #fff; color: var(--ink); text-align: left;
  border-radius: 18px; padding: 12px 14px;
  box-shadow: inset 0 0 0 1px var(--line);
}
.login-ico {
  width: 44px; height: 44px; flex: none; border-radius: 14px;
  display: grid; place-items: center;
}
.login-copy { display: grid; gap: 2px; }
.login-copy strong { font-size: 16px; }
.login-copy span { color: rgba(23, 36, 30, 0.6); font-size: 13px; font-weight: 650; }
.login-tg .login-ico { background: #2aabee; }
.login-phone .login-ico { background: #1c7777; }
.login-test {
  background: transparent; box-shadow: none; justify-content: center; color: #1c7777; padding: 6px;
}
.login-test .login-ico { width: 28px; height: 28px; background: transparent; color: #1c7777; }
.login-test .login-copy strong { font-size: 15px; }
.primary:disabled, .secondary:disabled { opacity: 0.55; cursor: wait; }
.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.captcha-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.captcha-row img { height: 72px; border-radius: 12px; background: #fff; }
.alert {
  background: #f8e7e2; color: var(--coral); border-radius: 14px; padding: 12px 14px; margin: 0;
}
.hint { color: rgba(23, 36, 30, 0.68); font-size: 14px; line-height: 1.45; margin: 0; }
.actions { display: grid; gap: 10px; margin-top: 18px; }
.action {
  text-align: left; border: 0; background: var(--paper-2); border-radius: 20px; padding: 16px;
  box-shadow: inset 0 0 0 1px var(--line); display: grid; gap: 4px;
}
.action strong { font-size: 17px; }
.action span { color: rgba(23, 36, 30, 0.65); font-size: 14px; }
.action.gold { background: #f3e4c4; }
.panel {
  margin-top: 16px; padding: 16px; border-radius: 20px; background: var(--forest); color: var(--paper);
}
.panel p { margin: 6px 0 0; color: rgba(244, 239, 228, 0.78); }
.viewfinder { position: relative; border-radius: 22px; overflow: hidden; background: #08140f; min-height: 280px; }
#scan.is-ready .viewfinder { display: none; }
.viewfinder video { width: 100%; display: block; min-height: 280px; object-fit: cover; }
.frame {
  pointer-events: none; position: absolute; inset: 16% 12%; border-radius: 18px;
  box-shadow: 0 0 0 200vmax rgba(8, 20, 16, 0.45);
  border: 2px solid var(--gold-2);
}
.bill { display: grid; gap: 8px; padding: 14px; border-radius: 18px; background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--line); }
.bill h3 { margin: 0; font-size: 18px; }
.bill-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.bill-row span, .bill-row b { min-width: 0; overflow-wrap: anywhere; }
.bill-row b { text-align: right; font-weight: 750; }
.bill-item { display: grid; gap: 2px; padding-top: 8px; border-top: 1px solid var(--line); }
.bill-item strong { overflow-wrap: anywhere; }
.bill-item span { color: rgba(23, 36, 30, 0.62); font-size: 13px; }
.coupon {
  background: var(--paper-2);
  border-radius: 18px;
  padding: 14px 16px 14px 18px;
  box-shadow: inset 4px 0 0 var(--gold);
  display: grid; gap: 4px;
}
.coupon b { font-family: Unbounded, Manrope, sans-serif; font-size: 24px; letter-spacing: 0.02em; }
.coupon small, .muted { color: rgba(23, 36, 30, 0.62); }
.status-accepted { background: #e5f2ea; }
.status-pending_review { background: #f8efd8; }
.status-rejected, .status-error { background: #f8e7e2; }
.pill {
  display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 10px;
  font-size: 12px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
}
.here-btn {
  margin-top: auto; width: 100%; min-height: 72px; border: 0; border-radius: 24px;
  font-size: 22px; font-weight: 800; background: var(--forest); color: var(--paper);
}
.here-btn.is-off, .here-btn:disabled {
  background: #d9d3c7; color: rgba(23, 36, 30, 0.45); cursor: default;
}
.here-btn.is-done { background: #e5f2ea; color: var(--pine); }
.sheet-back {
  position: absolute; inset: 0; z-index: 6;
  background: rgba(16, 24, 20, 0.45);
  display: flex; align-items: flex-end;
}
.sheet {
  width: 100%; background: var(--paper); color: var(--ink);
  border-radius: 24px 24px 0 0; padding: 18px 18px 22px;
}
.here-view { min-height: 220px; }
.here-view video { min-height: 220px; }
.ok-banner { background: #e5f2ea; color: var(--pine); border-radius: 16px; padding: 14px; font-weight: 700; }

body.admin { background: #e7efe9; color: var(--ink); }
.admin-login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.card { width: min(420px, 100%); background: var(--paper); border-radius: 28px; padding: 28px; box-shadow: var(--shadow); }
.admin-shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100dvh; }
.nav { background: var(--forest); color: var(--paper); padding: 22px 14px; display: grid; align-content: start; gap: 6px; }
.nav button {
  text-align: left; border: 0; background: transparent; color: var(--paper); border-radius: 12px; padding: 11px 12px; font-weight: 700;
}
.nav button.on { background: rgba(244, 239, 228, 0.14); }
.workspace { padding: 28px; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { background: white; border-radius: 18px; padding: 16px; }
.stat b { display: block; font-family: Manrope, sans-serif; font-size: 28px; font-weight: 800; margin-top: 6px; font-variant-numeric: tabular-nums; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.table-wrap { overflow: auto; background: white; border-radius: 18px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: rgba(23, 36, 30, 0.55); }
.warn { background: #f8efd8; border-radius: 16px; padding: 14px 16px; color: var(--amber); }
.tenant { background: white; border-radius: 16px; padding: 12px 14px; margin-bottom: 8px; }
.tenant header { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.registers { display: none; margin-top: 8px; }
.tenant.open .registers { display: block; }
.mini { border: 0; background: var(--paper); border-radius: 10px; padding: 6px 8px; font-weight: 700; }

@media (max-width: 520px) {
  .stage { padding: 0; height: 100dvh; }
  .phone { height: 100dvh; min-height: 0; border-radius: 0; }
}
@media (max-width: 980px) {
  .admin-shell { grid-template-columns: 1fr; }
  .nav { grid-auto-flow: column; overflow: auto; }
  .cards { grid-template-columns: 1fr 1fr; }
  .workspace { padding: 16px; }
}
