:root {
  --text: #333333;
  --danger: #e20a3f;
  --success: #05820e;
  --blue: #006fd6;
  --muted: #7b7f88;
  --line: #d3d3d3;
  --soft: #f7f8fa;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: #ffffff;
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
  letter-spacing: 0;
  min-height: 100vh;
}

.tokopedia-page {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 16px 18px 24px;
}

.brand {
  text-align: center;
}

.brand-prudential {
  width: min(230px, 56vw);
  height: auto;
  margin: 0 auto 9px;
  display: block;
}

.brand hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0 0 10px;
}

.brand-tokopedia {
  width: min(205px, 62vw);
  height: auto;
  display: block;
  margin: 0 auto 14px;
}

h1 {
  font-size: clamp(22px, 2.4vw, 27px);
  line-height: 1.22;
  color: #000000;
  font-weight: 700;
  margin: 0 0 14px;
}

.status-line {
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  background: var(--soft);
  padding: 10px 12px;
  font-size: clamp(16px, 1.8vw, 20px);
  line-height: 1.28;
  margin: 0 0 14px;
}

.status-line strong {
  color: var(--success);
  font-weight: 700;
}

.status-line strong.blocked {
  color: #d71920;
}

.tnc {
  background: #f5f5f5;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 14px;
}

.tnc summary {
  min-height: 48px;
  width: min(310px, 100%);
  padding: 12px 16px;
  background: #eeeeee;
  color: var(--text);
  cursor: pointer;
  font-size: clamp(16px, 1.7vw, 20px);
  font-weight: 600;
  line-height: 1.2;
}

.tnc-body {
  padding: 14px 20px 18px;
  font-size: 16px;
  line-height: 1.45;
}

.prompt {
  font-size: clamp(17px, 1.7vw, 20px);
  line-height: 1.32;
  margin: 0 0 10px;
}

.redeem-form {
  display: grid;
  gap: 9px;
  margin-bottom: 12px;
}

.redeem-form label {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.redeem-form input {
  width: 100%;
  min-height: 46px;
  border: 1px solid #ccd3dd;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 16px;
  color: var(--text);
  outline: none;
}

.redeem-form input:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(226, 10, 63, 0.12);
}

.redeem-form button {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  background: var(--danger);
  color: #ffffff;
  font-size: clamp(19px, 1.8vw, 23px);
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}

.redeem-form button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.message,
.state-message {
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 16px;
  line-height: 1.4;
}

.message.error,
.state-message {
  color: #8f1f1f;
  background: #fff0f0;
  border: 1px solid #f1c3c3;
}

.message.success {
  color: #125c20;
  background: #effaf1;
  border: 1px solid #bfe7c6;
}

.success-panel {
  border: 1px solid #b7dfbf;
  background: linear-gradient(180deg, #f2fbf4 0%, #ffffff 100%);
  border-radius: 8px;
  padding: 14px;
  margin: 8px 0 14px;
}

.success-panel p {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.45;
}

.success-title {
  color: #126820;
  font-size: 20px;
  font-weight: 800;
}

.success-note {
  color: #596273;
}

.voucher-code-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
  margin: 8px 0 10px;
}

.voucher-code-box strong {
  min-height: 52px;
  display: flex;
  align-items: center;
  border: 1px solid #c9efd1;
  border-radius: 8px;
  background: #ffffff;
  color: #126820;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.copy-voucher-button {
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  background: #16a34a;
  color: #ffffff;
  padding: 0 18px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.copy-voucher-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.voucher-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 0 0 10px;
}

.voucher-meta div {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  padding: 9px 10px;
}

.voucher-meta dt {
  color: #6c7482;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.voucher-meta dd {
  margin: 0;
  color: #20242c;
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.success-panel a,
.support a,
.secondary-link {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.support {
  font-size: clamp(15px, 1.5vw, 18px);
  line-height: 1.38;
  margin: 14px 0 18px;
}

footer {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  text-align: center;
  color: var(--muted);
  font-size: clamp(15px, 1.4vw, 18px);
}

footer strong {
  color: #ff0000;
}

.voucher-page {
  width: min(100%, 640px);
  margin: 0 auto;
  min-height: 100vh;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  padding: 32px;
  text-align: center;
}

.voucher-logo {
  width: min(320px, 80vw);
  height: auto;
}

.voucher-page strong {
  display: block;
  padding: 18px 24px;
  border-radius: 8px;
  background: #f2f7f3;
  color: #17833b;
  font-size: 24px;
}

@media (max-width: 640px) {
  .tokopedia-page {
    padding: 18px 16px 30px;
  }

  .redeem-form button {
    min-height: 64px;
  }

  .voucher-code-box,
  .voucher-meta {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 760px) and (max-height: 760px) {
  .tokopedia-page {
    width: min(100%, 760px);
    padding-top: 12px;
    padding-bottom: 18px;
  }

  .brand-prudential {
    width: 205px;
    margin-bottom: 8px;
  }

  .brand-tokopedia {
    width: 180px;
    margin-bottom: 12px;
  }

  h1 {
    font-size: 23px;
    margin-bottom: 9px;
  }

  .status-line,
  .tnc,
  .prompt,
  .support {
    margin-bottom: 12px;
  }

  .redeem-form {
    gap: 8px;
    margin-bottom: 10px;
  }

  .support {
    margin-top: 12px;
  }
}

.admin-body {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  background: #f6f7fb;
  color: #20242c;
  overflow-x: hidden;
}

.admin-sidebar {
  background: #ffffff;
  border-right: 1px solid #dfe3eb;
  padding: 24px 18px;
}

.admin-sidebar img {
  display: block;
  width: 170px;
  height: auto;
  margin: 0 0 28px;
}

.admin-sidebar nav {
  display: grid;
  gap: 6px;
}

.admin-sidebar a {
  min-height: 40px;
  display: flex;
  align-items: center;
  border-radius: 8px;
  padding: 0 12px;
  color: #303642;
  font-weight: 600;
  text-decoration: none;
}

.admin-sidebar a.active,
.admin-sidebar a:hover {
  background: #eef2f7;
  color: #d71920;
}

.admin-main {
  min-width: 0;
  padding: 22px;
  overflow-x: hidden;
}

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

.admin-kicker {
  margin: 0 0 4px;
  color: #6c7482;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.admin-main h1 {
  margin: 0;
  font-size: 30px;
}

.admin-main h2,
.admin-main h3 {
  margin: 0;
  color: #20242c;
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.store-badge {
  border: 1px solid #cfd6e1;
  border-radius: 999px;
  background: #ffffff;
  color: #596273;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
}

.admin-panel {
  min-width: 0;
  background: #ffffff;
  border: 1px solid #dfe3eb;
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 18px;
}

.auth-panel {
  width: min(100%, 420px);
}

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

.panel-heading.compact {
  align-items: center;
  margin-bottom: 12px;
}

.panel-tools,
.table-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.panel-heading p {
  margin: 5px 0 0;
  color: #6c7482;
  font-size: 14px;
}

.admin-form,
.code-form {
  display: grid;
  gap: 12px;
}

.code-form {
  grid-template-columns: minmax(120px, 150px) minmax(100px, 120px) minmax(140px, 170px) minmax(0, 1fr) minmax(110px, 130px);
  align-items: end;
}

.admin-form label,
.code-form label {
  display: grid;
  gap: 6px;
  color: #3a4150;
  font-size: 13px;
  font-weight: 700;
}

.admin-form input,
.code-form input,
.code-form textarea,
.generated-panel textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cfd6e1;
  border-radius: 8px;
  padding: 10px 12px;
  color: #20242c;
  font: inherit;
}

.email-list-field {
  grid-row: span 2;
}

.code-form textarea {
  min-height: 90px;
  resize: vertical;
}

.field-note {
  color: #6c7482;
  font-size: 12px;
  font-weight: 500;
}

.code-form input[type="file"] {
  border: 0;
  min-height: auto;
  padding: 0;
  font-size: 13px;
}

.generated-panel {
  border-top: 1px solid #e3e7ef;
  margin-top: 16px;
  padding-top: 16px;
}

.generated-panel textarea {
  min-height: 92px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, 180px) minmax(130px, 150px) auto;
  align-items: end;
  gap: 10px;
  margin: 0 0 12px;
}

.code-filter-row {
  grid-template-columns: minmax(0, 1fr) minmax(150px, 220px) minmax(130px, 170px) auto;
}

.batch-filter-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.filter-row label {
  display: grid;
  gap: 6px;
  color: #3a4150;
  font-size: 13px;
  font-weight: 700;
}

.filter-row input,
.filter-row select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cfd6e1;
  border-radius: 8px;
  padding: 9px 11px;
  background: #ffffff;
  color: #20242c;
  font: inherit;
  font-weight: 500;
}

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

.primary-button,
.ghost-button,
.button-link {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.primary-button,
.button-link.primary-button {
  border: 0;
  background: #e20a3f;
  color: #ffffff;
}

.ghost-button,
.button-link {
  border: 1px solid #cfd6e1;
  background: #ffffff;
  color: #303642;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.compact-button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.admin-message {
  border-radius: 8px;
  padding: 10px 12px;
  margin: 12px 0 0;
  font-size: 14px;
}

.admin-message.error {
  color: #8f1f1f;
  background: #fff0f0;
  border: 1px solid #f1c3c3;
}

.admin-message.success {
  color: #125c20;
  background: #effaf1;
  border: 1px solid #bfe7c6;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  border: 1px solid #e1e6ee;
  border-radius: 8px;
}

.codes-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
  table-layout: fixed;
  font-size: 13px;
}

.inventory-table {
  min-width: 0;
}

.batches-table {
  min-width: 0;
}

.codes-table th,
.codes-table td {
  border-bottom: 1px solid #e1e6ee;
  padding: 9px 8px;
  text-align: left;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.codes-table th {
  background: #f8fafc;
  color: #5b6472;
  font-size: 11px;
  text-transform: uppercase;
}

.codes-table strong,
.codes-table a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.codes-table td a {
  color: #006fd6;
  font-weight: 700;
  text-decoration: none;
}

.status-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.table-status {
  color: #05820e;
  font-weight: 700;
}

.table-status.redeemed {
  color: #6c7482;
}

.table-status.failed,
.table-status.inactive,
.table-status.suspended,
.table-status.expired {
  color: #d71920;
}

.status-select,
.inventory-input {
  width: 100%;
  max-width: 100%;
  min-height: 34px;
  border: 1px solid #cfd6e1;
  border-radius: 8px;
  padding: 6px 8px;
  background: #ffffff;
  color: #20242c;
  font: inherit;
  font-size: 13px;
}

.inventory-input {
  min-height: 56px;
  resize: vertical;
  display: block;
  margin-bottom: 8px;
}

.inventory-csv-input {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0 0 8px;
  color: #596273;
  font-size: 13px;
}

.codes-table:not(.batches-table, .inventory-table, .rewards-table) th:nth-child(1),
.codes-table:not(.batches-table, .inventory-table, .rewards-table) td:nth-child(1) {
  width: 19%;
}

.codes-table:not(.batches-table, .inventory-table, .rewards-table) th:nth-child(2),
.codes-table:not(.batches-table, .inventory-table, .rewards-table) td:nth-child(2) {
  width: 12%;
}

.codes-table:not(.batches-table, .inventory-table, .rewards-table) th:nth-child(3),
.codes-table:not(.batches-table, .inventory-table, .rewards-table) td:nth-child(3) {
  width: 8%;
}

.codes-table:not(.batches-table, .inventory-table, .rewards-table) th:nth-child(4),
.codes-table:not(.batches-table, .inventory-table, .rewards-table) td:nth-child(4) {
  width: 9%;
}

.codes-table:not(.batches-table, .inventory-table, .rewards-table) th:nth-child(5),
.codes-table:not(.batches-table, .inventory-table, .rewards-table) td:nth-child(5) {
  width: 13%;
}

.codes-table:not(.batches-table, .inventory-table, .rewards-table) th:nth-child(6),
.codes-table:not(.batches-table, .inventory-table, .rewards-table) td:nth-child(6) {
  width: 11%;
}

.codes-table:not(.batches-table, .inventory-table, .rewards-table) th:nth-child(7),
.codes-table:not(.batches-table, .inventory-table, .rewards-table) td:nth-child(7) {
  width: 14%;
}

.codes-table:not(.batches-table, .inventory-table, .rewards-table) th:nth-child(8),
.codes-table:not(.batches-table, .inventory-table, .rewards-table) td:nth-child(8) {
  width: 6%;
}

.codes-table:not(.batches-table, .inventory-table, .rewards-table) th:nth-child(9),
.codes-table:not(.batches-table, .inventory-table, .rewards-table) td:nth-child(9) {
  width: 8%;
}

.inventory-table th:nth-child(1),
.inventory-table td:nth-child(1) {
  width: 15%;
}

.inventory-table th:nth-child(2),
.inventory-table td:nth-child(2) {
  width: 18%;
}

.inventory-table th:nth-child(3),
.inventory-table td:nth-child(3) {
  width: 14%;
}

.inventory-table th:nth-child(4),
.inventory-table td:nth-child(4) {
  width: 14%;
}

.inventory-table th:nth-child(5),
.inventory-table td:nth-child(5) {
  width: 9%;
}

.inventory-table th:nth-child(6),
.inventory-table td:nth-child(6) {
  width: 12%;
}

.inventory-table th:nth-child(7),
.inventory-table td:nth-child(7) {
  width: 10%;
}

.inventory-table th:nth-child(8),
.inventory-table td:nth-child(8) {
  width: 8%;
}

.batches-table th:nth-child(1),
.batches-table td:nth-child(1) {
  width: 23%;
}

.batches-table th:nth-child(7),
.batches-table td:nth-child(7) {
  width: 20%;
}

.batches-table th:nth-child(8),
.batches-table td:nth-child(8) {
  width: 13%;
}

.rewards-table th:nth-child(1),
.rewards-table td:nth-child(1) {
  width: 24%;
}

.rewards-table th:nth-child(5),
.rewards-table td:nth-child(5) {
  width: 34%;
}

.muted-text {
  color: #6c7482;
  font-size: 13px;
  font-weight: 600;
}

.empty-cell {
  color: #6c7482;
  text-align: center;
}

@media (max-width: 880px) {
  .admin-body {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    border-right: 0;
    border-bottom: 1px solid #dfe3eb;
    padding: 16px;
  }

  .admin-sidebar img {
    margin-bottom: 14px;
  }

  .admin-sidebar nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .admin-main {
    padding: 16px;
  }

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

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

  .filter-row,
  .code-filter-row,
  .batch-filter-row {
    grid-template-columns: 1fr;
  }

  .filter-actions,
  .panel-tools,
  .table-actions {
    align-items: stretch;
  }

  .filter-actions .primary-button,
  .filter-actions .ghost-button,
  .panel-tools .button-link,
  .panel-tools .ghost-button {
    flex: 1;
  }
}
