:root {
  --bg: #050506;
  --panel: #111113;
  --panel-strong: #18181b;
  --ink: #f5f5f6;
  --muted: #a7a7ad;
  --line: #2c2c31;
  --brand: #e30613;
  --brand-dark: #a8000b;
  --accent: #ff1d2d;
  --danger: #ef4444;
  --ok: #22c55e;
  --wait: #f97316;
  --soft: rgba(227, 6, 19, 0.13);
  --shadow: 0 24px 82px rgba(0, 0, 0, 0.56);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(227, 6, 19, 0.18), transparent 32%),
    linear-gradient(315deg, rgba(255, 255, 255, 0.07), transparent 28%),
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.045) 0 1px, transparent 1px 72px),
    var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

button {
  border: 0;
  border-radius: var(--radius);
  padding: 11px 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent),
    var(--brand);
  color: #fff;
  cursor: pointer;
  font-weight: 850;
  letter-spacing: 0.01em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
  transition:
    transform 0.12s ease,
    background 0.12s ease,
    border-color 0.12s ease,
    opacity 0.12s ease;
}

button:hover {
  background: var(--brand-dark);
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.ghost {
  border: 1px solid var(--line);
  background: #202025;
  color: var(--ink);
}

.ghost:hover {
  background: #2a2a31;
}

.danger {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent),
    var(--danger);
}

.danger:hover {
  background: #9a3412;
}

.layout {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px;
}

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

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 420px);
  width: min(1040px, 100%);
  overflow: hidden;
  background: rgba(13, 13, 15, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.brand-pane {
  min-height: 560px;
  padding: 42px;
  background:
    linear-gradient(135deg, rgba(4, 4, 5, 0.96), rgba(95, 0, 8, 0.76)),
    linear-gradient(45deg, transparent 0 46%, rgba(227, 6, 19, 0.35) 46% 49%, transparent 49% 100%),
    repeating-linear-gradient(105deg, rgba(255, 255, 255, 0.08) 0 2px, transparent 2px 20px);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.brand-pane h1 {
  margin: 0;
  font-size: clamp(36px, 5vw, 64px);
  line-height: 0.96;
  letter-spacing: 0.08em;
  text-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
}

.brand-pane p {
  width: min(520px, 100%);
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.84);
  font-size: 18px;
}

.brand-logo {
  width: min(300px, 100%);
  margin-bottom: 24px;
  padding: 13px 16px;
  border: 1px solid rgba(227, 6, 19, 0.54);
  border-radius: 8px;
  background: #fff;
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.34),
    0 0 0 6px rgba(227, 6, 19, 0.08);
}

.brand-logo img {
  display: block;
  width: 100%;
  height: auto;
}

.brand-foot {
  color: rgba(255, 255, 255, 0.76);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.login-form {
  padding: 42px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}

.login-form h2 {
  margin: 0 0 4px;
  font-size: 24px;
  letter-spacing: 0;
}

.field {
  display: grid;
  gap: 7px;
}

.field span,
.label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field-note {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #09090b;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
  transition:
    border-color 0.12s ease,
    box-shadow 0.12s ease,
    background 0.12s ease;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.18);
}

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.code-sample {
  margin: 12px 0 10px;
  padding: 12px 14px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.topbar {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.topbar h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
  line-height: 1.12;
}

.topbrand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
}

.topbrand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 34px;
  padding: 5px 7px;
  border: 1px solid rgba(227, 6, 19, 0.36);
  border-radius: var(--radius);
  background: #fff;
}

.topbrand-logo img {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

.product-name {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.topbar-actions,
.row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.top-stats {
  grid-template-columns: repeat(3, minmax(160px, 1fr));
}

.dashboard-stats {
  margin-bottom: 0;
}

.rules-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
  gap: 14px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid rgba(227, 6, 19, 0.42);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(227, 6, 19, 0.16), transparent 38%),
    linear-gradient(180deg, #18181b, #111113);
}

.rules-panel strong {
  display: block;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 16px;
}

.rules-panel p {
  margin: 6px 0;
  color: var(--ink);
}

.rules-penalties {
  display: grid;
  gap: 8px;
}

.rules-penalties span {
  display: block;
  padding: 10px 12px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.11);
  color: #fecaca;
  line-height: 1.4;
}

.withdraw-box {
  display: grid;
  grid-template-columns: minmax(220px, 0.75fr) minmax(0, 1.25fr);
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #09090b;
}

.withdraw-box strong {
  display: block;
  margin: 6px 0;
  color: var(--accent);
  font-size: 26px;
}

.stat,
.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stat {
  padding: 16px;
  background:
    linear-gradient(90deg, rgba(227, 6, 19, 0.12), transparent 42%),
    linear-gradient(180deg, var(--panel-strong), var(--panel));
}

.stat strong {
  display: block;
  margin-top: 5px;
  font-size: 23px;
  line-height: 1.08;
  letter-spacing: 0;
}

.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  overflow-x: auto;
}

.tab {
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 12px 14px;
  white-space: nowrap;
}

.tab:hover,
.tab.active {
  background: var(--soft);
  color: var(--accent);
}

.panel {
  padding: 18px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.panel h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0;
}

.mobile-bottom-nav {
  display: none;
}

.grid {
  display: grid;
  gap: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(170px, 1fr));
  gap: 12px;
  align-items: end;
}

.form-grid .wide {
  grid-column: span 3;
}

.filters {
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(220px, 1fr) minmax(130px, 160px) minmax(130px, 160px);
  gap: 12px;
  margin-bottom: 14px;
}

.dropdown-field {
  position: relative;
}

.multi-select {
  position: relative;
}

.multi-select-button {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  background: #09090b;
  color: var(--ink);
  text-align: left;
}

.multi-select-button:hover {
  background: #17171b;
}

.multi-select-arrow {
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
}

.multi-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 15;
  display: grid;
  gap: 4px;
  max-height: 286px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #09090b;
  box-shadow: var(--shadow);
}

.multi-select-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 8px;
  border-radius: 7px;
  cursor: pointer;
}

.multi-select-option:hover {
  background: var(--soft);
}

.multi-select-option input {
  width: auto;
}

.multi-select-clear {
  margin-top: 4px;
  width: 100%;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #09090b;
  cursor: pointer;
  user-select: none;
}

.chip input {
  width: auto;
}

.form-chip {
  justify-content: center;
  min-height: 42px;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(90px, 120px) minmax(90px, 120px) minmax(120px, 150px) minmax(160px, 1fr) minmax(130px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  min-width: 760px;
}

.inline-form input,
.inline-form select {
  min-height: 38px;
  padding: 8px 10px;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #202025;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.available {
  background: rgba(255, 255, 255, 0.11);
  color: #f4f4f5;
}

.active {
  background: rgba(227, 6, 19, 0.18);
  color: #fecdd3;
}

.review {
  background: rgba(249, 115, 22, 0.18);
  color: #fed7aa;
}

.approved {
  background: rgba(34, 197, 94, 0.14);
  color: #bbf7d0;
}

.rejected,
.expired {
  background: rgba(239, 68, 68, 0.16);
  color: #fecaca;
}

.notice-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  display: grid;
  gap: 10px;
  width: min(380px, calc(100vw - 36px));
}

.notice {
  background: #09090b;
  color: #fff;
  border: 1px solid rgba(227, 6, 19, 0.34);
  border-radius: 8px;
  padding: 13px 14px;
  box-shadow: var(--shadow);
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 5, 6, 0.72);
}

.modal {
  width: min(720px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  background: var(--panel);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.modal h3 {
  margin: 0 0 14px;
}

.pdf-frame {
  width: 100%;
  height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #09090b;
}

@media (max-width: 900px) {
  .login-shell,
  .split,
  .filters,
  .rules-panel,
  .withdraw-box {
    grid-template-columns: 1fr;
  }

  .brand-pane {
    min-height: 340px;
  }

  .stats,
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .form-grid .wide {
    grid-column: span 2;
  }
}

@media (max-width: 620px) {
  body {
    background:
      linear-gradient(150deg, rgba(227, 6, 19, 0.18), transparent 42%),
      repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 58px),
      var(--bg);
    font-size: 14px;
  }

  .layout {
    padding: 12px 12px calc(132px + env(safe-area-inset-bottom));
  }

  .topbar,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    gap: 10px;
    margin-bottom: 12px;
    padding: 2px 0 4px;
  }

  .topbar h1 {
    font-size: 21px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .topbar-actions button {
    width: auto;
    min-height: 38px;
    padding: 9px 12px;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

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

  .top-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stats {
    margin-bottom: 12px;
  }

  .stat {
    min-height: 78px;
    padding: 10px;
  }

  .stat strong {
    font-size: 17px;
    overflow-wrap: anywhere;
  }

  .top-stats .stat {
    min-height: 74px;
    padding: 9px 7px;
  }

  .top-stats .hint {
    font-size: 10px;
    line-height: 1.15;
  }

  .top-stats .stat strong {
    font-size: 14px;
    line-height: 1.15;
  }

  .form-grid .wide {
    grid-column: span 1;
  }

  .login-form,
  .brand-pane {
    padding: 26px;
  }

  .login {
    padding: 12px;
  }

  .login-shell {
    width: 100%;
  }

  .brand-pane {
    min-height: 250px;
  }

  .brand-logo {
    width: min(230px, 100%);
    margin-bottom: 16px;
    padding: 10px 12px;
  }

  .topbrand-logo {
    width: 66px;
    height: 30px;
  }

  .brand-pane h1 {
    font-size: 38px;
  }

  .brand-pane p {
    font-size: 15px;
  }

  .user-tabs {
    display: none;
  }

  .admin-tabs {
    gap: 6px;
    margin: 0 -12px 14px;
    padding: 0 12px 2px;
    border-bottom: 0;
  }

  .admin-tabs .tab {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #09090b;
    padding: 10px 12px;
  }

  .mobile-bottom-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 25;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    background:
      linear-gradient(180deg, rgba(28, 28, 32, 0.96), rgba(9, 9, 11, 0.96));
    box-shadow:
      0 18px 50px rgba(0, 0, 0, 0.62),
      inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(14px);
  }

  .mobile-nav-item {
    min-width: 0;
    min-height: 42px;
    display: grid;
    place-items: center;
    padding: 7px 5px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    box-shadow: none;
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    line-height: 1.05;
  }

  .mobile-nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--ink);
  }

  .mobile-nav-item span {
    max-width: 100%;
    white-space: normal;
  }

  .mobile-nav-item.active {
    border-color: rgba(227, 6, 19, 0.42);
    background:
      linear-gradient(180deg, rgba(227, 6, 19, 0.34), rgba(122, 0, 10, 0.42));
    color: #fff;
  }

  .mobile-nav-item.active:hover {
    background:
      linear-gradient(180deg, rgba(227, 6, 19, 0.42), rgba(122, 0, 10, 0.48));
  }

  .panel {
    padding: 13px;
  }

  .panel h2 {
    font-size: 17px;
  }

  .filters {
    gap: 10px;
  }

  .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .chip {
    flex: 0 0 auto;
    min-height: 40px;
  }

  .rules-panel {
    margin-bottom: 14px;
    padding: 12px;
  }

  .rules-panel strong {
    font-size: 15px;
  }

  .rules-panel p,
  .rules-penalties span {
    font-size: 13px;
  }

  .withdraw-box {
    padding: 12px;
  }

  .withdraw-box strong {
    font-size: 22px;
  }

  .table-wrap {
    overflow: visible;
  }

  table {
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 10px;
  }

  tr {
    display: grid;
    gap: 8px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #09090b;
  }

  td {
    display: grid;
    grid-template-columns: minmax(92px, 0.42fr) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 0;
    border-bottom: 0;
    overflow-wrap: anywhere;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
  }

  td.row-actions {
    display: grid;
    grid-template-columns: minmax(92px, 0.42fr) minmax(0, 1fr);
    align-items: center;
  }

  .row-actions button,
  td input[type="file"] {
    width: 100%;
    min-height: 40px;
  }

  .badge {
    width: fit-content;
  }
}
