:root {
  color: #302530;
  background: #f8f4f1;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.page {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 42px 24px 80px;
}

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

#admin-login[hidden],
#admin-app[hidden] {
  display: none !important;
}

.login-card {
  width: min(100%, 440px);
  padding: 34px;
  border: 1px solid #eadfe5;
  border-radius: 24px;
  background:
    radial-gradient(circle at right top, rgb(204 238 52 / 33%), transparent 34%),
    linear-gradient(135deg, #fff 0%, #fff5fa 100%);
  box-shadow: 0 18px 48px rgb(62 23 48 / 10%);
}

.login-form {
  display: grid;
  gap: 9px;
  margin-top: 26px;
}

.login-form label {
  color: #4d3847;
  font-size: 0.86rem;
  font-weight: 700;
}

.login-form .button {
  width: 100%;
  margin-top: 6px;
}

.hero,
.panel,
.metric-card,
.technical-status {
  border: 1px solid #eadfe5;
  box-shadow: 0 14px 36px rgb(62 23 48 / 7%);
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 32px;
  border-radius: 24px;
  background:
    radial-gradient(circle at right top, rgb(204 238 52 / 33%), transparent 32%),
    linear-gradient(135deg, #fff 0%, #fff5fa 100%);
}

.hero-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 14px;
}

.eyebrow {
  margin: 0 0 7px;
  color: #a94172;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  color: #4b1238;
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -0.045em;
}

h2 {
  margin-bottom: 0;
  color: #352435;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}

h3 {
  margin-bottom: 8px;
  color: #4b1238;
  font-size: 1.02rem;
}

.lead,
.description {
  margin-bottom: 0;
  color: #746672;
  line-height: 1.55;
}

.lead {
  font-size: 1rem;
}

.description {
  max-width: 620px;
  font-size: 0.88rem;
  text-align: right;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid #d92770;
  border-radius: 11px;
  background: linear-gradient(135deg, #e91e63, #f06292);
  color: #fff;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.button:hover:not(:disabled) {
  box-shadow: 0 5px 14px rgb(233 30 99 / 25%);
  transform: translateY(-1px);
}

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

.button--secondary {
  border-color: #e6ccd9;
  background: #fff;
  color: #a94172;
}

.button--small {
  min-height: 34px;
  padding: 8px 11px;
  border-radius: 9px;
  font-size: 0.8rem;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 22px 0;
}

.metric-card {
  display: grid;
  gap: 8px;
  padding: 20px;
  border-radius: 18px;
  background: #fff;
}

.metric-label {
  color: #857684;
  font-size: 0.82rem;
  font-weight: 600;
}

.metric-value {
  color: #542143;
  font-size: clamp(1.45rem, 3vw, 2rem);
  letter-spacing: -0.04em;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  overflow-x: auto;
}

.tab {
  position: relative;
  flex: 0 0 auto;
  padding: 11px 16px;
  border: 1px solid #ebdfe5;
  border-radius: 11px;
  background: #fff;
  color: #796b77;
  font-weight: 700;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.tab:hover,
.tab--active {
  border-color: #e91e63;
  background: #fff0f5;
  color: #bc1854;
}

.tab-badge {
  display: inline-flex;
  min-width: 18px;
  min-height: 18px;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e91e63;
  color: #fff;
  font-size: 0.68rem;
}

.panel {
  display: none;
  padding: 28px;
  border-radius: 22px;
  background: #fff;
}

.panel--active {
  display: block;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.search-form {
  display: flex;
  width: min(100%, 440px);
  gap: 8px;
}

.participants-test-filter {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  color: #806f7b;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.participants-test-filter input {
  width: 16px;
  min-width: 16px;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
}

.review-filter {
  display: grid;
  min-width: 190px;
  gap: 6px;
  color: #806f7b;
  font-size: 0.78rem;
  font-weight: 700;
}

.review-filter select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #ddcbd5;
  border-radius: 11px;
  background: #fff;
  color: #392d37;
  padding: 8px 12px;
}

input {
  min-width: 0;
  flex: 1;
  border: 1px solid #ddcbd5;
  border-radius: 11px;
  background: #fff;
  color: #392d37;
  padding: 10px 12px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 3px solid rgb(233 30 99 / 24%);
  outline-offset: 2px;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid #f0e6eb;
  border-radius: 14px;
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid #f0e6eb;
  text-align: left;
  vertical-align: middle;
}

th {
  background: #fff7fa;
  color: #886d7c;
  font-size: 0.71rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: #fffafd;
}

.number-cell {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: right;
}

.ticket-number-cell {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: left;
}

.draw-ticket-cell {
  text-align: center;
}

.participants-table .participants-number-cell {
  text-align: left;
}

.participants-table {
  min-width: 900px;
}

.code-cell {
  color: #a94172;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  font-weight: 700;
}

.empty-cell {
  padding: 32px;
  color: #847683;
  text-align: center;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.pagination-label {
  color: #806f7b;
  font-size: 0.82rem;
}

.draw-tiers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.draw-tier {
  display: flex;
  min-height: 248px;
  flex-direction: column;
  padding: 20px;
  border: 1px solid #ecdfe6;
  border-radius: 18px;
}

.draw-tier--basic {
  background: linear-gradient(145deg, #fcfcfd, #f0f2f5);
}

.draw-tier--medium {
  background: linear-gradient(145deg, #fffdf6, #fff4cf);
}

.draw-tier--top {
  background: linear-gradient(145deg, #fff7fa, #ffe3ef);
}

.draw-range {
  margin-bottom: 14px;
  color: #a94172;
  font-size: 0.86rem;
  font-weight: 800;
}

.draw-prizes {
  flex: 1;
  margin-bottom: 10px;
  color: #695d66;
  font-size: 0.8rem;
  line-height: 1.55;
}

.draw-saved-state {
  min-height: 2.6em;
  margin: 0 0 14px;
  color: #806f7b;
  font-size: 0.76rem;
  line-height: 1.35;
}

.draw-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.draw-actions .button {
  width: 100%;
}

.draw-result,
.past-draws {
  margin-top: 28px;
}

.draw-result {
  padding: 22px;
  border: 2px solid #ccee34;
  border-radius: 18px;
  background: linear-gradient(135deg, #fbffeb, #fff);
}

.draw-result h3 {
  margin-bottom: 6px;
}

.draw-meta {
  margin-bottom: 18px;
  color: #6a7350;
  font-size: 0.86rem;
}

.past-draws h3,
.subheading {
  margin: 30px 0 12px;
}

.task-pool {
  border: 1px solid #ecdee6;
  border-radius: 16px;
  background: #fffafd;
}

.task-pool summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  cursor: pointer;
  list-style: none;
}

.task-pool summary::-webkit-details-marker {
  display: none;
}

.task-pool summary .eyebrow {
  display: block;
  margin-bottom: 4px;
}

.task-pool summary strong {
  color: #4b1238;
  font-size: 1.02rem;
}

.task-pool-toggle {
  flex: 0 0 auto;
  color: #a94172;
  font-size: 0.8rem;
  font-weight: 800;
}

.task-pool[open] {
  padding: 0 20px 20px;
}

.task-pool[open] summary {
  margin: 0 -20px;
}

.task-pool[open] .task-pool-toggle {
  font-size: 0;
}

.task-pool[open] .task-pool-toggle::after {
  content: "Скрыть";
  font-size: 0.8rem;
}

.task-pool > .description {
  max-width: none;
  margin: 0 0 16px;
  text-align: left;
}

.past-draw-list {
  display: grid;
  gap: 10px;
}

.past-draw {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid #ecdee6;
  border-radius: 14px;
}

.past-draw strong,
.past-draw span {
  display: block;
}

.past-draw strong {
  margin-bottom: 3px;
}

.past-draw span,
.empty-text {
  color: #7b6d78;
  font-size: 0.82rem;
}

.text-button {
  border: 0;
  background: transparent;
  color: #b51d57;
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.review-image-link {
  display: grid;
  width: min(180px, 100%);
  gap: 6px;
  color: #a94172;
  font-size: 0.76rem;
  font-weight: 700;
  text-decoration: none;
}

.review-image {
  display: block;
  width: 100%;
  max-height: 130px;
  border: 1px solid #edd9e4;
  border-radius: 9px;
  object-fit: cover;
}

.review-evidence-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-text-link {
  display: inline-block;
  max-width: 280px;
  overflow-wrap: anywhere;
  color: #b51d57;
  font-weight: 700;
  text-underline-offset: 3px;
}

.review-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
}

.review-status--pending {
  background: #fff1cb;
  color: #886719;
}

.review-status--approved {
  background: #e8f7e8;
  color: #287446;
}

.review-status--rejected {
  background: #fff0f2;
  color: #b62b24;
}

.review-actions {
  display: flex;
  min-width: 196px;
  gap: 7px;
}

.review-actions .button {
  flex: 1 1 0;
}

.review-decision {
  display: grid;
  min-width: 150px;
  gap: 5px;
  color: #806f7b;
  font-size: 0.76rem;
  line-height: 1.4;
}

.review-decision p {
  margin: 0;
  color: #674b5c;
}

.test-label {
  display: inline-flex;
  margin: 0 0 0 7px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #ebe8ff;
  color: #6757aa;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  vertical-align: middle;
}

.review-dialog-description {
  margin: 0 0 16px;
  color: #746672;
  font-size: 0.88rem;
  line-height: 1.5;
}

.dialog textarea {
  display: block;
  width: 100%;
  min-height: 112px;
  resize: vertical;
  border: 1px solid #ddcbd5;
  border-radius: 11px;
  color: #392d37;
  padding: 10px 12px;
}

.technical-status {
  margin-top: 18px;
  padding: 14px 18px;
  border-radius: 14px;
  background: #fff;
  color: #756773;
  font-size: 0.86rem;
}

.status--ok {
  color: #287446;
}

.status--error {
  color: #b62b24;
}

.dialog {
  width: min(460px, calc(100vw - 32px));
  border: 1px solid #e7d3de;
  border-radius: 20px;
  box-shadow: 0 24px 80px rgb(44 16 43 / 28%);
  padding: 26px;
}

.dialog::backdrop {
  background: rgb(46 20 38 / 42%);
}

.dialog h2 {
  margin-bottom: 20px;
}

.dialog label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.86rem;
  font-weight: 700;
}

.dialog input {
  width: 100%;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.form-result {
  min-height: 1.3em;
  margin: 10px 0 0;
  color: #746672;
  font-size: 0.84rem;
}

.form-result--error {
  color: #b62b24;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 900px) {
  .metrics,
  .draw-tiers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-heading {
    flex-direction: column;
  }

  .description {
    text-align: left;
  }

  .search-form {
    width: 100%;
  }
}

@media (max-width: 620px) {
  .page {
    padding: 20px 14px 48px;
  }

  .hero,
  .panel {
    padding: 20px;
    border-radius: 18px;
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-actions {
    width: 100%;
    justify-content: space-between;
  }

  .metrics,
  .draw-tiers {
    grid-template-columns: 1fr;
  }

  .metrics {
    gap: 10px;
  }

  .metric-card {
    padding: 16px;
  }

  .search-form,
  .review-actions {
    flex-direction: column;
  }

  .draw-actions {
    grid-template-columns: 1fr;
  }

  .review-actions {
    min-width: 112px;
  }

  .past-draw {
    align-items: flex-start;
    flex-direction: column;
  }

  .past-draw .button {
    width: 100%;
  }

  .pagination {
    justify-content: center;
    flex-wrap: wrap;
  }
}
