:root {
  --ink: #172238;
  --navy: #111a2d;
  --blue: #2f66e8;
  --line: #dce3ea;
  --muted: #8795a5;
  --soft: #f2f6fa;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: #eef2f5;
  color: #253348;
  font-family: "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

.hidden {
  display: none !important;
}

.site-header {
  display: flex;
  height: 58px;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1120px) / 2));
  border-bottom: 1px solid #d9e0e6;
  background: #fff;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.site-brand img {
  width: 32px;
  height: 32px;
  border-radius: 7px;
}

.secure-label {
  color: #788797;
  font-size: 11px;
}

.page-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 28px auto 50px;
}

.document {
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(31, 46, 61, 0.08);
}

.document-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.order-number {
  color: #384bd7;
  font-size: 30px;
  font-weight: 850;
  line-height: 1.15;
}

.seller {
  margin-top: 10px;
  color: #91a0af;
  font-size: 11px;
}

.document-kind {
  color: var(--navy);
  font-size: 17px;
  font-weight: 850;
  text-align: right;
}

.document-kind small {
  display: block;
  margin-top: 7px;
  color: #92a1b1;
  font-size: 10px;
  font-weight: 600;
}

.rule {
  height: 2px;
  margin: 24px 0;
  background: var(--navy);
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 22px;
}

.info-block {
  min-height: 120px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  font-size: 12px;
  line-height: 1.7;
}

.info-block strong {
  color: #17243b;
}

.info-label {
  margin-bottom: 8px;
  color: #8fa0b1;
  font-size: 10px;
  font-weight: 800;
}

.table-scroll {
  overflow-x: auto;
}

.item-table {
  width: 100%;
  min-width: 760px;
  margin: 0;
  table-layout: fixed;
  border-collapse: collapse;
}

.item-table th {
  padding: 12px 7px;
  background: var(--navy);
  color: #fff;
  font-size: 11.5px;
  text-align: left;
  white-space: nowrap;
}

.item-table td {
  height: 88px;
  padding: 8px 7px;
  border-bottom: 1px solid #dfe5eb;
  font-size: 12px;
  vertical-align: middle;
}

.item-table tbody tr:nth-child(even) {
  background: #f1f5f8;
}

.item-table .center {
  text-align: center;
}

.item-table .number {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.item-table .strong {
  font-weight: 800;
}

.product-name {
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.product-image,
.image-empty {
  width: 72px;
  height: 72px;
  margin: auto;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #edf1f4;
}

.product-image {
  display: block;
  object-fit: cover;
}

.image-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #99a5b0;
  font-size: 9px;
  font-weight: 700;
}

.type-badge {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 10px;
  background: #e8f2ff;
  color: #2e68ac;
  font-size: 9px;
  font-weight: 800;
}

.totals {
  width: 320px;
  margin: 22px 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.totals div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 13px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}

.totals div:last-child {
  border: 0;
}

.total-usd {
  background: var(--blue);
  color: #fff;
  font-size: 13px !important;
}

.total-krw {
  background: #eaf2ff;
  color: #2262c4;
}

.document-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 32px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
  color: #96a4b2;
  font-size: 9.5px;
}

.state-panel,
.message-box {
  max-width: 520px;
  margin: 18vh auto;
  padding: 48px 28px;
  text-align: center;
}

.state-panel h1,
.message-box h1 {
  margin-top: 16px;
  color: var(--ink);
  font-size: 20px;
}

.state-panel p,
.message-box p {
  margin-top: 9px;
  color: #7d8b99;
  font-size: 12px;
  line-height: 1.6;
}

.spinner {
  width: 34px;
  height: 34px;
  margin: auto;
  border: 3px solid #d9e3ed;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.state-icon {
  display: flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  margin: auto;
  border-radius: 50%;
  background: #ffe8e5;
  color: #bf3e32;
  font-size: 20px;
  font-weight: 800;
}

.message-page {
  display: flex;
  align-items: center;
  justify-content: center;
}

.message-box {
  margin: 0;
}

.brand-logo {
  width: 52px;
  height: 52px;
  border-radius: 10px;
}

.access-panel {
  width: min(460px, 100%);
  margin: 14vh auto 0;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(31, 46, 61, 0.08);
}

.access-mark {
  display: flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--navy);
  color: #fff;
  font-size: 11px;
  font-weight: 850;
}

.access-panel h1 {
  margin-top: 17px;
  color: var(--ink);
  font-size: 20px;
}

.access-panel > p {
  margin-top: 8px;
  color: #7d8b99;
  font-size: 12px;
  line-height: 1.6;
}

.access-panel form {
  margin-top: 24px;
}

.access-panel label {
  display: block;
  margin-bottom: 7px;
  color: #526273;
  font-size: 11px;
  font-weight: 750;
}

.access-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.access-controls input {
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #cbd5df;
  border-radius: 5px;
  color: var(--ink);
  font-size: 14px;
  letter-spacing: 0;
  text-transform: lowercase;
}

.access-controls input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(47, 102, 232, 0.12);
  outline: none;
}

.access-controls button {
  height: 40px;
  padding: 0 15px;
  border: 0;
  border-radius: 5px;
  background: var(--blue);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.access-controls button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.access-error {
  min-height: 17px;
  margin-top: 8px;
  color: #bd3e36;
  font-size: 11px;
}

.decision-panel {
  display: flex;
  min-height: 78px;
  flex-direction: column;
  align-items: flex-end;
  margin-top: 28px;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
}

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

.decision-button {
  height: 38px;
  min-width: 100px;
  padding: 0 16px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 850;
}

.decision-button.confirm {
  border: 1px solid #247348;
  background: #247348;
  color: #fff;
}

.decision-button.reject {
  border: 1px solid #c54a43;
  background: #fff;
  color: #b43b35;
}

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

.decision-result {
  display: flex;
  min-width: 230px;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border: 1px solid #cfe3d7;
  border-radius: 6px;
  background: #f0f8f3;
}

.decision-result.rejected {
  border-color: #ead0ce;
  background: #fff4f3;
}

.decision-symbol {
  display: flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #247348;
  color: #fff;
  font-size: 17px;
  font-weight: 900;
}

.decision-result.rejected .decision-symbol {
  background: #bd413a;
}

.decision-result div strong,
.decision-result div span {
  display: block;
}

.decision-result strong {
  color: #1f6540;
  font-size: 12px;
}

.decision-result.rejected strong {
  color: #a93631;
}

.decision-result div span {
  margin-top: 3px;
  color: #758391;
  font-size: 10px;
}

.decision-error {
  min-height: 16px;
  margin-top: 7px;
  color: #bd3e36;
  font-size: 11px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 680px) {
  .site-header {
    padding: 0 16px;
  }

  .secure-label {
    display: none;
  }

  .page-shell {
    width: calc(100% - 20px);
    margin: 10px auto 28px;
  }

  .document {
    padding: 20px 14px;
  }

  .document-head {
    display: block;
  }

  .order-number {
    font-size: 22px;
    overflow-wrap: anywhere;
  }

  .document-kind {
    margin-top: 18px;
    text-align: left;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .totals {
    width: 100%;
  }

  .document-foot {
    flex-direction: column;
    gap: 15px;
  }
}

@media (max-width: 480px) {
  .access-panel {
    margin-top: 8vh;
    padding: 24px 18px;
  }

  .access-controls {
    grid-template-columns: 1fr;
  }

  .access-controls button {
    width: 100%;
  }

  .decision-panel {
    align-items: stretch;
  }

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

  .decision-button {
    width: 100%;
  }

  .decision-result {
    min-width: 0;
  }
}
