:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #18212b;
  --muted: #66717f;
  --line: #d9e0e6;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --gold: #b7791f;
  --red: #b42318;
  --green: #067647;
  --shadow: 0 18px 42px rgba(24, 33, 43, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: 0;
}

a {
  color: var(--teal-dark);
  text-decoration: none;
}

main {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto 48px;
}

.topbar {
  width: min(1120px, calc(100% - 32px));
  min-height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--ink);
}

.brand img {
  width: auto;
  height: 46px;
  object-fit: contain;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  font-size: 13px;
}

.top-actions,
.lang-switch,
.admin-nav,
.admin-actions,
.actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.top-actions {
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.lang-switch {
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.lang-switch a {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.lang-switch a.active {
  background: var(--teal);
  color: #fff;
}

.admin-nav a,
.admin-actions a,
.button-link,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--teal);
  background: var(--teal);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.admin-nav a {
  min-height: 36px;
  font-size: 14px;
}

.secondary {
  color: var(--teal-dark);
  background: #fff;
}

.hero,
.admin-head,
.detail-head,
.result {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  margin: 18px 0 18px;
  padding: 28px;
  background: linear-gradient(135deg, #ffffff 0%, #edf7f5 60%, #f9f1df 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero h1,
.admin-head h1,
.detail-head h1,
.result h1,
.login-panel h1 {
  margin: 0;
  max-width: 780px;
  font-size: clamp(26px, 3.3vw, 38px);
  line-height: 1.15;
  font-weight: 800;
}

.lead {
  max-width: 720px;
  margin: 10px 0 0;
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 13px;
  text-transform: uppercase;
  font-weight: 800;
}

.deadline {
  min-width: 174px;
  padding: 14px;
  border: 1px solid rgba(15, 118, 110, .28);
  border-radius: 8px;
  background: rgba(255, 255, 255, .72);
}

.deadline span,
.deadline strong {
  display: block;
}

.deadline span {
  color: var(--muted);
  font-size: 13px;
}

.deadline strong {
  color: var(--teal-dark);
  font-size: 22px;
  margin-top: 4px;
}

.award-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 18px 0;
}

.award-strip div,
.form-section,
.detail-card,
.login-panel,
.table-wrap,
.filters {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.award-strip div {
  padding: 16px;
}

.award-strip b,
.award-strip span {
  display: block;
}

.award-strip span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.application {
  display: grid;
  gap: 14px;
}

.form-section {
  padding: 22px;
}

.form-section h2,
.detail-card h2 {
  margin: 0 0 14px;
  font-size: 20px;
}

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

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

label {
  display: grid;
  gap: 8px;
  color: #2d3744;
  font-weight: 700;
}

label span {
  color: var(--red);
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
}

.full {
  margin-top: 14px;
}

.score-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

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

.upload-box {
  border: 1px dashed #9fb4bd;
  border-radius: 8px;
  padding: 14px;
  background: #f8fbfb;
  font-weight: 800;
}

.file-control {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.file-control input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  background: #e7f5f2;
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.file-name {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-box p,
.upload-box small,
.muted,
footer {
  color: var(--muted);
}

.upload-box small {
  display: block;
  font-weight: 500;
  line-height: 1.45;
}

.upload-note {
  margin: 14px 0 0;
  color: var(--muted);
}

.checks {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.checks label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 600;
}

.checks input {
  width: 20px;
  min-height: 20px;
  margin-top: 2px;
}

.signature {
  max-width: 420px;
}

.actions {
  justify-content: flex-end;
  margin-top: 22px;
}

.actions button {
  min-width: 160px;
}

.submit-row {
  display: grid;
  grid-template-columns: minmax(240px, 420px) auto;
  gap: 14px;
  align-items: end;
}

.submit-row button {
  min-width: 150px;
}

.flash-wrap {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto 16px;
}

.flash {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.flash.error {
  border-color: #fecdca;
  color: var(--red);
  background: #fffbfa;
}

.flash.success {
  border-color: #abefc6;
  color: var(--green);
  background: #f6fef9;
}

.result {
  display: block;
  max-width: 760px;
  margin: 36px auto;
}

.result-list {
  margin: 18px 0;
}

.result .button-link {
  margin-top: 18px;
}

.login-panel {
  max-width: 420px;
  margin: 42px auto;
  padding: 28px;
}

.login-panel form {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.filters {
  display: grid;
  grid-template-columns: 1fr 180px auto;
  gap: 12px;
  padding: 14px;
  margin-bottom: 16px;
}

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

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

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

th {
  color: #465364;
  background: #f8fafb;
  font-size: 14px;
}

td small {
  color: var(--muted);
}

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

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef4ff;
  color: #3538cd;
  font-size: 13px;
  font-weight: 800;
}

.status.approved,
.status.shortlisted {
  color: var(--green);
  background: #ecfdf3;
}

.status.rejected {
  color: var(--red);
  background: #fef3f2;
}

.status.needs_info {
  color: #b54708;
  background: #fffaeb;
}

.detail-head {
  align-items: center;
}

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

.detail-card {
  padding: 24px;
  margin-bottom: 18px;
}

.detail-card.wide {
  width: 100%;
}

dl {
  display: grid;
  grid-template-columns: 136px 1fr;
  gap: 10px 16px;
  margin: 0;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.wide-list {
  grid-template-columns: 160px 1fr;
}

.preline {
  white-space: pre-wrap;
}

.attachments {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.attachments li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.attachments span {
  color: var(--muted);
}

.attachments b,
.attachments a {
  display: block;
}

.attachments b {
  color: var(--ink);
  font-size: 14px;
}

.review-form {
  display: grid;
  gap: 14px;
  max-width: 680px;
}

footer {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto 36px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 14px;
}

@media (max-width: 760px) {
  main,
  .topbar,
  .flash-wrap,
  footer {
    width: min(100% - 24px, 1080px);
  }

  .topbar {
    min-height: 68px;
    align-items: center;
    flex-wrap: wrap;
    padding: 10px 0;
  }

  .brand {
    flex: 1 1 220px;
    min-width: 0;
  }

  .brand span {
    min-width: 0;
  }

  .brand img {
    height: 40px;
  }

  .top-actions {
    width: auto;
    margin-left: auto;
    justify-content: flex-end;
  }

  .hero,
  .admin-head,
  .detail-head {
    display: block;
    padding: 20px;
  }

  .deadline {
    margin-top: 20px;
  }

  .award-strip,
  .grid.two,
  .grid.three,
  .detail-grid,
  .filters,
  .upload-grid,
  .submit-row {
    grid-template-columns: 1fr;
  }

  .form-section,
  .detail-card {
    padding: 18px;
  }

  .score-row {
    grid-template-columns: 1fr;
  }

  dl,
  .wide-list {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  dd {
    margin-bottom: 8px;
  }

  footer {
    display: grid;
  }
}
