:root {
  color-scheme: light;
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 16px;
  letter-spacing: 0;
  color: #1c2321;
  background: #f3f6f5;
  --ink: #1c2321;
  --muted: #66716d;
  --line: #d5ddda;
  --surface: #ffffff;
  --accent: #087f5b;
  --accent-hover: #06694b;
  --danger: #b42318;
  --header: #202624;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

button,
a {
  font: inherit;
  letter-spacing: 0;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(8, 127, 91, 0.28);
  outline-offset: 2px;
}

.redeem-page {
  min-height: 100vh;
  background: #f3f6f5;
}

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

.redeem-panel {
  width: min(100%, 400px);
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 14px 35px rgba(28, 35, 33, 0.08);
}

.product-mark,
.header-mark {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: var(--accent);
  color: #ffffff;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 750;
}

.product-name {
  margin: 14px 0 28px;
  color: var(--muted);
  font-size: 14px;
}

.redeem-panel h1 {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.3;
}

.status-text {
  min-height: 24px;
  margin: 12px 0 24px;
  color: var(--muted);
  line-height: 1.5;
}

.status-text.is-error,
.state-indicator.is-error {
  color: var(--danger);
}

.primary-button,
.quiet-button {
  min-height: 42px;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.primary-button {
  width: 100%;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
  font-weight: 650;
}

.primary-button:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.primary-button:disabled,
.quiet-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.secondary-link {
  display: inline-block;
  margin-top: 18px;
  color: var(--accent);
  text-decoration: none;
}

.viewer-page {
  min-height: 100vh;
  background: #ffffff;
}

.app-header {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 28px;
  background: var(--header);
  color: #ffffff;
  border-bottom: 3px solid var(--accent);
}

.header-brand,
.session-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-brand {
  min-width: 0;
  font-weight: 650;
}

.header-mark {
  flex: 0 0 36px;
}

.session-expiry {
  min-width: 92px;
  color: #c9d2cf;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  text-align: right;
}

.quiet-button {
  padding: 0 14px;
  border: 1px solid #66706d;
  background: transparent;
  color: #ffffff;
}

.quiet-button:hover:not(:disabled) {
  border-color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.viewer-main {
  width: min(100%, 1440px);
  margin: 0 auto;
  padding: 34px 28px 48px;
}

.view-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.view-heading h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.3;
}

.view-meta {
  min-height: 21px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.state-indicator {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 14px;
  font-weight: 650;
}

.table-region {
  width: 100%;
  min-height: 240px;
  border-top: 1px solid var(--line);
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid #e3e8e6;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

th {
  position: sticky;
  top: 0;
  background: #eef3f1;
  color: #37413e;
  font-size: 13px;
  font-weight: 700;
}

td {
  color: #27302d;
  line-height: 1.45;
}

tbody tr:hover {
  background: #f7faf9;
}

.empty-state,
.error-state {
  display: grid;
  min-height: 240px;
  place-items: center;
  color: var(--muted);
}

.error-state {
  color: var(--danger);
}

[hidden] {
  display: none !important;
}

@media (max-width: 680px) {
  .redeem-shell {
    align-items: start;
    padding: 18px;
  }

  .redeem-panel {
    margin-top: 12vh;
    padding: 26px 22px;
  }

  .app-header {
    align-items: flex-start;
    padding: 10px 16px;
  }

  .header-brand > span:last-child {
    display: none;
  }

  .session-actions {
    gap: 8px;
  }

  .quiet-button {
    min-height: 38px;
    padding: 0 10px;
  }

  .viewer-main {
    padding: 26px 16px 36px;
  }

  .view-heading {
    align-items: flex-start;
  }

  .view-heading h1 {
    font-size: 22px;
  }
}
