:root {
  --ink: #18352f;
  --muted: #647872;
  --line: #d5e2de;
  --paper: #ffffff;
  --canvas: #eef5f2;
  --brand: #0c6655;
  --brand-dark: #08493e;
  --danger: #b73c42;
  --warning: #a26506;
  --shadow: 0 18px 50px rgba(20, 55, 47, .12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at top, #fbfefd 0, var(--canvas) 55%); }
button, input { font: inherit; }
button { touch-action: manipulation; }
.shared-body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.shared-shell { flex: 1; width: min(100% - 24px, 720px); margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 0 32px; }
.shared-footer { width: min(100% - 24px, 720px); margin: 0 auto; padding: 18px 0 max(24px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.5; text-align: center; }
.join-card, .team-card, .box-meter { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.join-card { max-width: 520px; margin: 8vh auto 0; padding: clamp(24px, 7vw, 44px); }
.shared-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 34px; }
.shared-brand .brand-mark { display: block; flex: 0 0 auto; width: 40px; height: 40px; object-fit: contain; }
.shared-brand strong { font-size: 18px; }
.shared-eyebrow { margin: 0 0 5px; color: var(--brand); font-size: 11px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: clamp(27px, 7vw, 39px); line-height: 1.08; }
h2 { margin-bottom: 0; font-size: 20px; }
.join-series { color: var(--muted); }
.join-form { display: grid; gap: 17px; margin-top: 28px; }
.join-form label, .scan-form label { display: grid; gap: 7px; font-size: 13px; font-weight: 800; }
input { min-width: 0; height: 52px; padding: 0 15px; border: 1px solid #b9ccc6; border-radius: 12px; color: var(--ink); background: #fff; outline: 0; }
input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(12, 102, 85, .12); }
.join-hint { margin: 20px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.shared-button { min-height: 48px; padding: 0 17px; border: 0; border-radius: 12px; font-weight: 850; cursor: pointer; }
.shared-button:disabled { cursor: not-allowed; opacity: .45; }
.shared-button.primary { color: #fff; background: var(--brand); }
.shared-button.primary:active { background: var(--brand-dark); }
.shared-button.secondary { color: var(--brand-dark); background: #dcece7; }
.shared-button.camera { color: #fff; background: #253e59; }
.scanner-console { display: grid; gap: 14px; }
.console-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 9px 4px 3px; }
.console-head h1 { font-size: 29px; margin-bottom: 3px; }
.console-head > div > span { color: var(--muted); font-size: 14px; }
.connection-state { flex: 0 0 auto; padding: 7px 10px; border-radius: 999px; color: var(--muted); background: #e2ebe8; font-size: 11px; font-weight: 850; }
.connection-state.online { color: #096449; background: #d8f1e7; }
.connection-state.offline { color: #8c3035; background: #f6dddd; }
.box-meter { display: grid; grid-template-columns: 1fr auto; gap: 13px 20px; padding: 20px; }
.box-meter > div:first-child { display: grid; gap: 5px; }
.box-meter > div:first-child span { color: var(--muted); font-size: 13px; }
.box-meter > div:first-child strong { font-size: 22px; }
.box-count { display: flex; align-items: baseline; gap: 5px; }
.box-count strong { font-size: 38px; line-height: 1; color: var(--brand); }
.box-count span { color: var(--muted); font-weight: 800; }
.meter-track { grid-column: 1 / -1; height: 9px; overflow: hidden; border-radius: 20px; background: #dce7e3; }
.meter-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #22a477, #0c6655); transition: width .2s ease; }
.shared-message { display: grid; gap: 2px; min-height: 63px; padding: 13px 16px; border-radius: 14px; border: 1px solid transparent; }
.shared-message strong { font-size: 14px; }
.shared-message span { font-size: 13px; line-height: 1.35; }
.shared-message.neutral { color: #31534b; background: #e2ece9; border-color: #cbded8; }
.shared-message.success { color: #07573d; background: #d9f2e7; border-color: #aadbc9; }
.shared-message.error { color: #842d33; background: #f8e1e2; border-color: #e8babc; }
.shared-message.warning { color: #7a4b05; background: #f8ecd6; border-color: #e9d1a6; }
.scan-form { padding: 17px; border-radius: 17px; background: #163b34; }
.scan-form label { color: #dceae6; }
.scan-form > div { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.scan-form input { border: 0; }
.camera-actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.camera-panel { position: relative; overflow: hidden; min-height: 280px; border-radius: 18px; background: #101a1e; box-shadow: var(--shadow); }
.camera-panel video { display: block; width: 100%; min-height: 280px; max-height: 62vh; object-fit: cover; }
.camera-panel small { position: absolute; right: 12px; bottom: 12px; left: 12px; padding: 8px 10px; border-radius: 9px; color: #fff; background: rgba(0, 0, 0, .62); text-align: center; }
.camera-target { position: absolute; inset: 22% 14% 28%; border: 3px solid rgba(255,255,255,.9); border-radius: 15px; box-shadow: 0 0 0 999px rgba(0,0,0,.28); pointer-events: none; }
.camera-target::before, .camera-target::after { content: ""; position: absolute; width: 30px; height: 30px; border-color: #5df0b8; }
.camera-target::before { top: -4px; left: -4px; border-top: 5px solid #5df0b8; border-left: 5px solid #5df0b8; border-radius: 10px 0 0; }
.camera-target::after { right: -4px; bottom: -4px; border-right: 5px solid #5df0b8; border-bottom: 5px solid #5df0b8; border-radius: 0 0 10px; }
.console-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.team-card { padding: 18px; box-shadow: none; }
.team-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.team-title > span { display: grid; place-items: center; min-width: 34px; height: 30px; padding: 0 9px; border-radius: 999px; color: var(--brand); background: #e1f0eb; font-weight: 900; }
.workstation-list, .recent-list { display: grid; gap: 7px; }
.workstation-row, .recent-row { display: grid; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid #e6eeeb; }
.workstation-row { grid-template-columns: 1fr auto; }
.workstation-row:first-child, .recent-row:first-child { border-top: 0; }
.workstation-row strong, .workstation-row span { display: block; }
.workstation-row span, .recent-row span { color: var(--muted); font-size: 12px; }
.workstation-row.current strong::after { content: " вы"; margin-left: 7px; color: var(--brand); font-size: 10px; text-transform: uppercase; }
.workstation-progress { min-width: 78px; text-align: right; font-weight: 900; }
.recent-row { grid-template-columns: 70px minmax(0, 1fr); }
.recent-row time { color: var(--muted); font-size: 12px; }
.recent-row strong { overflow: hidden; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 460px) {
  .shared-shell { width: min(100% - 16px, 720px); padding-top: max(10px, env(safe-area-inset-top)); }
  .join-card { margin-top: 2vh; padding: 24px 20px; }
  .console-head { padding-inline: 3px; }
  .console-head h1 { font-size: 24px; }
  .box-meter { padding: 17px; }
  .scan-form > div { grid-template-columns: 1fr; }
  .console-actions { grid-template-columns: 1fr; }
  .camera-panel, .camera-panel video { min-height: 240px; }
}
