@charset "UTF-8";
:root {
  color-scheme: light;
  --bg: #f7f7fa;
  --surface: #fff;
  --text: #202127;
  --muted: #767780;
  --accent: #ed243b;
  --accent-dark: #cf152c;
  --accent-soft: #fff0f2;
  --line: #e6e6ec;
  --radius: 24px;
  --safe-top: max(env(safe-area-inset-top, 0px), var(--tg-safe-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-bottom, 0px));
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: #eaeaf0;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:focus-visible, input:focus-visible { outline: 3px solid #ed243b55; outline-offset: 3px; }
[hidden] { display: none !important; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.app-shell {
  width: min(100%, 1040px);
  min-height: 100dvh;
  margin: auto;
  background: var(--bg);
  box-shadow: 0 20px 90px #2824380d;
  position: relative;
}

.app-header {
  padding: calc(20px + var(--safe-top)) 34px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #efeff3;
}
.brand { display: flex; align-items: center; gap: 13px; }
.wordmark { font-size: 33px; font-weight: 850; letter-spacing: -2.7px; line-height: 1.1; }
.wordmark span { color: var(--accent); }
.admin-mark { padding: 6px 8px 5px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 8px; line-height: 1; font-weight: 750; letter-spacing: 1.3px; }
.header-caption { font-size: 9px; font-weight: 600; letter-spacing: 2px; color: var(--muted); }

main { padding: 32px 34px calc(48px + var(--safe-bottom)); }
.page-heading { margin-bottom: 24px; }
.eyebrow { font-size: 8px; letter-spacing: 1.8px; font-weight: 650; color: #74747e; }
.title-row { margin-top: 13px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
h1 { margin: 0; font-size: clamp(28px, 4vw, 38px); line-height: 1.1; letter-spacing: -1.4px; }
.title-row p { margin: 9px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.total-pill { min-width: 72px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 16px; background: #fff; display: grid; justify-items: center; }
.total-pill span:first-child { font-size: 19px; line-height: 1; font-weight: 750; font-variant-numeric: tabular-nums; }
.total-pill span:last-child { margin-top: 4px; font-size: 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }

.create-card { padding: 22px; border-radius: var(--radius); background: #fff; box-shadow: 0 10px 32px #302b4907; }
.create-card, .create-copy, .create-controls { display: flex; align-items: center; }
.create-card { justify-content: space-between; gap: 24px; }
.create-copy { gap: 14px; min-width: 0; }
.card-icon, .empty-icon { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: 0 0 auto; }
.card-icon .icon { width: 21px; height: 21px; }
.create-copy h2 { margin: 0; font-size: 15px; letter-spacing: -.2px; }
.create-copy p { margin: 6px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.create-controls { gap: 10px; flex: 0 0 auto; }
.quantity-field { height: 48px; display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); overflow: hidden; }
.quantity-field label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.quantity-field input { width: 58px; height: 100%; padding: 0; border: 0; outline: 0; background: transparent; color: var(--text); text-align: center; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.quantity-field input::-webkit-inner-spin-button, .quantity-field input::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }
.stepper { width: 40px; height: 100%; padding: 0; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; }
.stepper:hover { color: var(--accent); background: #fff; }
.stepper .icon { width: 15px; height: 15px; }
.primary-button { min-height: 48px; padding: 0 18px; border: 0; border-radius: 16px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 12px; font-weight: 650; box-shadow: 0 9px 24px #ed243b23; transition: background .2s, transform .2s; }
.primary-button:hover { background: var(--accent-dark); }
.primary-button:active { transform: scale(.985); }
.primary-button .icon { width: 17px; height: 17px; }
.field-error { flex-basis: 100%; margin: 4px 0 0 60px; color: #bf1630; font-size: 11px; }

.codes-section { margin-top: 34px; }
.section-row { margin: 0 2px 13px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.section-row h2 { margin: 0; font-size: 16px; letter-spacing: -.25px; }
.section-row p { margin: 6px 0 0; color: var(--muted); font-size: 9px; }
.inactive-count { color: var(--accent); font-size: 9px; font-weight: 650; white-space: nowrap; }

.table-wrap { border: 1px solid #ededf1; border-radius: var(--radius); background: #fff; overflow: hidden; box-shadow: 0 10px 32px #302b4905; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th { padding: 15px 13px 12px; border-bottom: 1px solid var(--line); color: #898993; font-size: 8px; font-weight: 650; letter-spacing: .65px; text-align: left; text-transform: uppercase; }
th:nth-child(1) { width: 22%; padding-left: 20px; }
th:nth-child(2) { width: 20%; }
th:nth-child(3), th:nth-child(4) { width: 24%; }
th:last-child { width: 10%; }
td { height: 68px; padding: 13px; border-bottom: 1px solid #f0f0f4; font-size: 11px; vertical-align: middle; }
td:first-child { padding-left: 20px; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .2s; }
tbody tr:hover { background: #fafafd; }
.code-cell { display: flex; align-items: center; gap: 8px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #b9b9c2; box-shadow: 0 0 0 4px #b9b9c214; flex: 0 0 auto; }
tr[data-active="false"] .status-dot { background: var(--accent); box-shadow: 0 0 0 4px #ed243b12; }
.code-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 700; letter-spacing: .35px; font-variant-numeric: tabular-nums; }
.user { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.user strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 650; }
.user span { color: var(--muted); font-size: 9px; }
.inactive-user { color: #90909a; font-weight: 550; }
.date { color: #4f5058; font-size: 10px; line-height: 1.45; font-variant-numeric: tabular-nums; }
.date-empty { color: #b0b0b9; }
.copy-button { width: 38px; height: 38px; margin-left: auto; padding: 0; display: grid; place-items: center; border: 0; border-radius: 12px; background: #f5f5f8; color: #73737d; transition: background .2s, color .2s, transform .2s; }
.copy-button:hover { color: var(--accent); background: var(--accent-soft); }
.copy-button:active { transform: scale(.94); }
.copy-button.copied { color: #21875b; background: #ecf8f2; }
.copy-button .icon { width: 17px; height: 17px; }

.empty-state { min-height: 250px; padding: 42px 20px; border: 1px dashed #dcdce4; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; flex-direction: column; background: #ffffff80; text-align: center; }
.empty-icon { width: 52px; height: 52px; border-radius: 18px; }
.empty-state h3 { margin: 15px 0 0; font-size: 14px; }
.empty-state p { margin: 7px 0 0; color: var(--muted); font-size: 10px; }
.toast { position: fixed; z-index: 10; bottom: calc(28px + var(--safe-bottom)); left: 50%; transform: translateX(-50%); width: min(calc(100% - 40px), 400px); padding: 14px 18px; border-radius: 16px; background: #26262fee; color: #fff; font-size: 11px; line-height: 1.55; box-shadow: 0 8px 28px #20212720; animation: appear .2s ease-out; }
@keyframes appear { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }

@media (min-width: 1100px) {
  body { padding: 28px 0; }
  .app-shell { min-height: calc(100dvh - 56px); border-radius: 34px; overflow: hidden; }
}

@media (max-width: 760px) {
  .app-header { padding-left: 22px; padding-right: 22px; }
  main { padding: 26px 20px calc(42px + var(--safe-bottom)); }
  .create-card { align-items: stretch; flex-direction: column; gap: 19px; }
  .create-controls { width: 100%; }
  .quantity-field { flex: 1; }
  .quantity-field input { width: 100%; }
  .primary-button { flex: 1; }
  .field-error { margin-left: 0; }

  .table-wrap { border: 0; border-radius: 0; background: transparent; box-shadow: none; overflow: visible; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tbody { display: grid; gap: 10px; }
  tbody tr { padding: 17px 16px; border: 1px solid #ededf1; border-radius: 20px; background: #fff; box-shadow: 0 8px 24px #302b4905; display: grid; grid-template-columns: 1fr auto; column-gap: 14px; }
  tbody tr:hover { background: #fff; }
  td { min-width: 0; height: auto; padding: 0; border: 0; }
  td:first-child { padding: 0 0 14px; grid-column: 1; }
  td:nth-child(2) { padding: 12px 0; border-top: 1px solid #f0f0f4; border-bottom: 1px solid #f0f0f4; grid-column: 1 / -1; }
  td:nth-child(3), td:nth-child(4) { padding-top: 14px; }
  td:nth-child(3) { grid-column: 1; }
  td:nth-child(4) { grid-column: 2; text-align: right; }
  td:last-child { grid-column: 2; grid-row: 1; }
  td:nth-child(3)::before, td:nth-child(4)::before { content: attr(data-label); display: block; margin-bottom: 5px; color: #9898a2; font-size: 7px; font-weight: 650; letter-spacing: .55px; text-transform: uppercase; }
  .copy-button { margin: -5px -4px 0 0; }
}

@media (max-width: 390px) {
  .header-caption { display: none; }
  .title-row { align-items: flex-start; }
  .total-pill { min-width: 64px; }
  .create-controls { align-items: stretch; flex-direction: column; }
  .quantity-field, .primary-button { width: 100%; flex: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.status-panel { padding: 26px; border-radius: 24px; background: #fff; text-align: center; }
.status-panel h2 { font-size: 17px; margin: 0; }
.status-panel p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.status-panel .primary-button { margin: 20px auto 0; }
button:disabled { cursor: default; opacity: .6; }
.quantity-field input:focus-visible { outline-offset: -3px; border-radius: 8px; }
.create-card { flex-wrap: wrap; }
.field-error { margin: 10px 0 0; }
.code-value { font-size: 10px; }
.code-copy { min-width: 0; }
.code-note { display: block; margin-top: 4px; color: var(--muted); font-size: 8px; line-height: 1.4; }
.code-value { display: block; user-select: all; }
.inactive-user { display: block; }
.status-note { display: block; margin-top: 4px; color: var(--muted); font-size: 8px; }
.secondary-button { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 16px; background: #fff; margin-top: 14px; font-size: 12px; font-weight: 600; }
.text-button { display: block; margin: 16px auto 0; border: 0; background: transparent; color: var(--muted); font-size: 11px; min-height: 40px; }
#codes-title:focus { outline: none; }
@media(max-width:760px) { .code-value { font-size: 11px; } }
