:root {
  --background: #eef2f6;
  --surface: #ffffff;
  --surface-muted: #f7f9fc;
  --text: #172033;
  --muted: #667085;
  --line: #d7e0eb;
  --primary: #146c43;
  --primary-dark: #0f5132;
  --primary-soft: #e7f6ed;
  --warning: #b54708;
  --warning-soft: #fff4e5;
  --danger: #b42318;
  --danger-soft: #fef0ef;
  --blue: #175cd3;
  --shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--background);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--background);
  font-family: Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-view {
  display: grid;
  min-height: 100vh;
  padding: 18px;
  place-items: center;
}

.login-card {
  width: min(100%, 430px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 28px;
}

.login-card p {
  margin: 0 0 24px;
  color: var(--muted);
}

.login-card label {
  display: block;
  margin-bottom: 7px;
  font-weight: 700;
}

.login-card input {
  width: 100%;
  min-height: 50px;
  margin-bottom: 12px;
  padding: 11px 13px;
  border: 1px solid #98a8bc;
  border-radius: 10px;
  outline: none;
}

.login-card input:focus,
.search-input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(20, 108, 67, 0.14);
}

.form-message {
  min-height: 20px;
  margin-top: 12px;
  color: var(--danger);
}

.app {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 2px 10px rgba(16, 24, 40, 0.05);
}

.event-title h1 {
  margin: 0 0 4px;
  font-size: 23px;
}

.connection-line {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.connection-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warning);
}

.connection-dot.online {
  background: var(--primary);
}

.connection-dot.offline {
  background: var(--danger);
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.button {
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 700;
}

.button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.button.primary,
.button.scan {
  color: #ffffff;
  background: var(--primary);
}

.button.primary:hover:not(:disabled),
.button.scan:hover:not(:disabled) {
  background: var(--primary-dark);
}

.button.light {
  border-color: var(--line);
  color: var(--text);
  background: var(--surface);
}

.button.danger {
  border-color: #f3b7b2;
  color: var(--danger);
  background: var(--danger-soft);
}

.button.register {
  color: #ffffff;
  background: var(--primary);
}

.counter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
  max-width: 1500px;
  margin: 0 auto;
  padding: 14px 20px 0;
}

.counter-card {
  display: flex;
  min-height: 82px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 3px 12px rgba(16, 24, 40, 0.04);
  flex-direction: column;
  justify-content: center;
}

.counter-card.success {
  border-color: #a8d9b8;
  background: var(--primary-soft);
}

.counter-card.warning {
  border-color: #f0c89b;
  background: var(--warning-soft);
}

.counter-value {
  font-size: 29px;
  font-weight: 800;
  line-height: 1;
}

.counter-label {
  margin-top: 5px;
  color: var(--muted);
}

.control-panel {
  max-width: 1500px;
  margin: 12px auto;
  padding: 0 20px;
}

.search-row,
.filter-row {
  display: flex;
  gap: 9px;
  align-items: center;
}

.search-row {
  margin-bottom: 9px;
}

.search-input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid #98a8bc;
  border-radius: 11px;
  background: var(--surface);
  outline: none;
}

.filter-row {
  flex-wrap: wrap;
}

.filter-row select {
  min-height: 42px;
  min-width: 160px;
  max-width: 320px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  outline: none;
}

.participant-panel {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 20px 30px;
}

.participant-header,
.participant-row {
  display: grid;
  grid-template-columns:
    110px
    minmax(210px, 1.25fr)
    minmax(220px, 1.2fr)
    minmax(180px, 0.9fr)
    145px
    170px;
  gap: 12px;
  align-items: center;
}

.participant-header {
  position: sticky;
  top: 78px;
  z-index: 10;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px 10px 0 0;
  color: var(--muted);
  background: #e8edf4;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.participant-row {
  min-height: 82px;
  padding: 11px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: var(--surface);
}

.participant-row:last-child {
  border-radius: 0 0 10px 10px;
}

.participant-row.checked {
  background: #f0faf4;
}

.participant-row.pending {
  border-left: 4px solid var(--warning);
}

.status-badge {
  display: inline-flex;
  width: fit-content;
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--muted);
  background: #edf1f6;
  font-size: 12px;
  font-weight: 700;
}

.status-badge.checked {
  color: var(--primary-dark);
  background: #cfead8;
}

.status-badge.pending {
  color: var(--warning);
  background: var(--warning-soft);
}

.participant-name {
  margin-bottom: 4px;
  font-size: 16px;
  font-weight: 800;
}

.participant-secondary {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.participant-qr {
  color: var(--blue);
  font-weight: 700;
}

.participant-action .button {
  width: 100%;
}

.empty-state {
  padding: 40px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: var(--surface);
  text-align: center;
}

.scanner-dialog {
  width: min(94vw, 640px);
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.scanner-dialog::backdrop {
  background: rgba(17, 24, 39, 0.78);
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
}

.dialog-header h2 {
  margin: 0 0 4px;
}

.dialog-header p {
  margin: 0;
  color: var(--muted);
}

.icon-button {
  min-height: 38px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.scanner-reader {
  min-height: 330px;
  margin: 0 16px;
  overflow: hidden;
  border-radius: 12px;
  background: #111827;
}

.scanner-message {
  min-height: 48px;
  padding: 12px 16px 16px;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  max-width: min(440px, calc(100vw - 36px));
  padding: 13px 16px;
  border-radius: 12px;
  color: #ffffff;
  background: #1f2937;
  box-shadow: var(--shadow);
  font-weight: 700;
}

.toast.success {
  background: var(--primary);
}

.toast.warning {
  background: var(--warning);
}

.toast.error {
  background: var(--danger);
}

@media (max-width: 1000px) {
  .participant-header {
    display: none;
  }

  .participant-row {
    grid-template-columns: 105px 1fr 170px;
    gap: 8px 12px;
    margin-bottom: 9px;
    border: 1px solid var(--line);
    border-radius: 12px;
  }

  .participant-row:last-child {
    border-radius: 12px;
  }

  .participant-company,
  .participant-category {
    grid-column: 2 / 4;
  }

  .participant-time {
    grid-column: 2;
  }

  .participant-action {
    grid-column: 3;
  }
}

@media (max-width: 720px) {
  .topbar {
    position: static;
    align-items: flex-start;
    padding: 12px;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions .button {
    flex: 1;
  }

  .counter-grid {
    grid-template-columns: repeat(2, 1fr);
    padding: 10px 10px 0;
  }

  .counter-card {
    min-height: 70px;
    padding: 10px;
  }

  .counter-value {
    font-size: 24px;
  }

  .control-panel,
  .participant-panel {
    padding-right: 10px;
    padding-left: 10px;
  }

  .search-row {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-row select,
  .filter-row .button {
    width: 100%;
    max-width: none;
  }

  .participant-row {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .participant-company,
  .participant-category,
  .participant-time,
  .participant-action {
    grid-column: 1;
  }

  .participant-action .button {
    min-height: 46px;
  }

  .scanner-reader {
    min-height: 280px;
  }
}
