:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --ink: #19211f;
  --muted: #66736d;
  --line: #dce3df;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #e3f4f1;
  --warn: #a15c07;
  --danger: #b42318;
  --ok: #1d7f45;
  --shadow: 0 18px 50px rgba(22, 33, 30, 0.08);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.08), rgba(246, 247, 244, 0) 260px),
    var(--bg);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 68px;
  padding: 0 32px;
  border-bottom: 1px solid rgba(220, 227, 223, 0.8);
  background: rgba(246, 247, 244, 0.88);
  backdrop-filter: blur(16px);
}

.brand {
  color: var(--ink);
  font-size: 20px;
  font-weight: 800;
  text-decoration: none;
}

.nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.nav-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.shell {
  width: min(1180px, calc(100% - 40px));
  margin: 34px auto 56px;
}

.workspace {
  display: grid;
  gap: 20px;
}

.two-column {
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.upload-panel,
.redeem-panel {
  padding: 24px;
}

.result-panel {
  min-width: 0;
  padding: 24px;
}

.panel-head {
  margin-bottom: 22px;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.15;
}

h2 {
  font-size: 22px;
  line-height: 1.2;
}

h3 {
  font-size: 18px;
  line-height: 1.25;
}

.upload-form,
.redeem-form,
.login-form {
  display: grid;
  gap: 14px;
}

.drop-zone {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 260px;
  padding: 24px;
  border: 1px dashed #a7b5af;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(255, 255, 255, 0.35)),
    #fbfcfb;
  text-align: center;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.drop-zone.dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.drop-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 32px;
  line-height: 1;
}

.drop-title {
  font-size: 20px;
  font-weight: 800;
}

.drop-meta,
.status-line {
  color: var(--muted);
  font-size: 14px;
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.primary-button,
.secondary-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 800;
}

.primary-button {
  min-width: 138px;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
}

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

.secondary-button {
  min-width: 104px;
  padding: 0 14px;
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.secondary-button:hover:not(:disabled) {
  border-color: #b6c4be;
  background: #f7faf8;
}

.icon-button {
  width: 40px;
  padding: 0;
  border-color: var(--line);
  background: #fff;
  color: var(--muted);
  line-height: 1;
}

.button-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.primary-button .button-icon {
  filter: brightness(0) invert(1);
}

.file-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.file-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--muted);
  font-size: 13px;
}

.file-chip strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-actions {
  margin-bottom: 12px;
}

.status-line {
  min-height: 20px;
  margin-bottom: 10px;
}

.latest-upload {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px 0 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.latest-upload[hidden] {
  display: none;
}

.latest-upload-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.code-output {
  min-height: 108px;
  resize: vertical;
  font-family: Consolas, "Courier New", monospace;
  font-weight: 800;
  white-space: pre;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

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

th {
  background: #f8faf8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

td {
  font-size: 14px;
}

tr:last-child td {
  border-bottom: 0;
}

.code-text {
  font-family: Consolas, "Courier New", monospace;
  font-weight: 800;
  white-space: nowrap;
}

.file-name {
  display: block;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-row td {
  color: var(--muted);
  text-align: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.pill.ok {
  background: #e8f7ed;
  color: var(--ok);
}

.pill.missing {
  background: #fff4e0;
  color: var(--warn);
}

.field-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

textarea {
  width: 100%;
  min-height: 300px;
  resize: vertical;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  color: var(--ink);
  line-height: 1.55;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.text-input {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  color: var(--ink);
}

.text-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.login-shell {
  width: min(440px, calc(100% - 40px));
  margin: 64px auto;
}

.login-panel {
  padding: 28px;
}

.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.page-info,
.total-count,
.page-size {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.page-size {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.page-size select {
  min-height: 36px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

@media (max-width: 900px) {
  .two-column {
    grid-template-columns: 1fr;
  }

  .shell {
    width: min(100% - 24px, 760px);
    margin-top: 22px;
  }

  .topbar {
    padding: 0 16px;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
  }

  .nav {
    width: 100%;
  }

  .nav-link {
    flex: 1;
    justify-content: center;
  }

  h1 {
    font-size: 28px;
  }

  .upload-panel,
  .redeem-panel,
  .result-panel {
    padding: 16px;
  }

  .drop-zone {
    min-height: 210px;
  }

  .primary-button,
  .secondary-button {
    flex: 1 1 138px;
  }

  .latest-upload-head {
    align-items: stretch;
    flex-direction: column;
  }
}
