:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #687385;
  --line: #dce3ee;
  --brand: #1f7a5c;
  --brand-dark: #14563f;
  --accent: #2364aa;
  --danger: #b42318;
  --warn: #996515;
  --ok: #157347;
  --shadow: 0 14px 36px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

a {
  color: var(--accent);
}

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

.login-card {
  width: min(420px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 4px;
  font-size: 22px;
}

h2 {
  margin-bottom: 16px;
  font-size: 18px;
}

h3 {
  margin-bottom: 12px;
  font-size: 15px;
}

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

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.field span {
  color: #344054;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  outline: none;
  padding: 10px 11px;
}

textarea {
  min-height: 76px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 122, 92, 0.12);
}

.btn {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 6px;
  padding: 9px 14px;
  background: #e9eef6;
  color: var(--ink);
  font-weight: 700;
}

.btn.primary {
  background: var(--brand);
  color: #fff;
}

.btn.primary:hover {
  background: var(--brand-dark);
}

.btn.danger {
  background: #fee4e2;
  color: var(--danger);
}

.btn.line {
  border: 1px solid var(--line);
  background: #fff;
}

.btn.small {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 13px;
}

.shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  padding: 14px 24px;
  backdrop-filter: blur(8px);
}

.topbar .brand {
  margin: 0;
}

.user-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.layout {
  display: grid;
  grid-template-columns: 230px 1fr;
  min-height: calc(100vh - 71px);
}

.side {
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 18px 12px;
}

.nav-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: flex-start;
  border-radius: 6px;
  background: transparent;
  color: #344054;
  margin-bottom: 6px;
  padding: 11px 12px;
  text-align: left;
}

.nav-button.active {
  background: #e8f4ef;
  color: var(--brand-dark);
  font-weight: 700;
}

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

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

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

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
  box-shadow: 0 1px 2px rgba(23, 32, 51, 0.03);
}

.span-2 {
  grid-column: span 2;
}

.file-input {
  display: grid;
  gap: 8px;
  border: 1px dashed #b8c4d4;
  border-radius: 8px;
  background: #fbfcfe;
  padding: 14px;
}

.preview {
  display: none;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.preview.show {
  display: block;
}

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

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

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

th {
  background: #f1f5f9;
  color: #344054;
  font-size: 13px;
  white-space: nowrap;
}

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

.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status.pending {
  background: #fff4d6;
  color: var(--warn);
}

.status.approved {
  background: #dcfce7;
  color: var(--ok);
}

.status.rejected {
  background: #fee4e2;
  color: var(--danger);
}

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

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

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

.stat strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.filters {
  display: grid;
  grid-template-columns: 1fr 170px 170px;
  gap: 10px;
  margin-bottom: 14px;
}

.toast {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 20;
  max-width: 360px;
  border-radius: 8px;
  background: #172033;
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.45);
  padding: 20px;
}

.modal {
  width: min(560px, 100%);
  border-radius: 8px;
  background: #fff;
  padding: 20px;
  box-shadow: var(--shadow);
}

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

.image-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

@media (max-width: 820px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .side {
    display: flex;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-button {
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .content {
    padding: 18px;
  }

  .grid,
  .stats,
  .filters {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }
}
