:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #10b981;
  --danger: #ef4444;
  --radius: 12px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: linear-gradient(135deg, #ffffff 0%, #e6f0ff 50%, #f0f8ff 100%);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
}

.wrap {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 1.25rem;
}

@media (min-width: 768px) {
  .wrap {
    max-width: 520px;
    padding: 2rem;
  }
}

@media (min-width: 1024px) {
  .wrap-wide {
    max-width: 960px;
  }
}

.brand {
  text-align: center;
  margin-bottom: 1.75rem;
}

.brand h1 {
  font-size: clamp(1.25rem, 4vw, 1.6rem);
  font-weight: 600;
  margin: 0 0 0.35rem;
  letter-spacing: 0.02em;
}

.brand p {
  display: none;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.25rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

@media (min-width: 768px) {
  .card {
    padding: 1.75rem 1.75rem;
  }
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 1rem;
}

input[type="text"],
input[type="password"],
input[type="file"] {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 1rem;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(61, 139, 253, 0.25);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  width: auto;
  padding: 0.45rem 0.85rem;
  font-size: 0.875rem;
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--muted);
}

.btn-danger {
  background: rgba(240, 113, 120, 0.2);
  color: var(--danger);
  border: 1px solid rgba(240, 113, 120, 0.4);
  width: auto;
  padding: 0.45rem 0.85rem;
  font-size: 0.875rem;
}

.msg {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.95rem;
  display: none;
}

.msg.show {
  display: block;
}

.msg.ok {
  background: rgba(62, 207, 142, 0.12);
  border: 1px solid rgba(62, 207, 142, 0.35);
  color: var(--success);
}

.msg.err {
  background: rgba(240, 113, 120, 0.1);
  border: 1px solid rgba(240, 113, 120, 0.35);
  color: var(--danger);
}

.footer-links {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.announcement {
  background: #e0f2fe;
  border: 1px solid #bae6fd;
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  color: #0369a1;
  font-size: 0.95rem;
  line-height: 1.4;
}

/* Admin dashboard */
.admin-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.admin-bar span {
  color: var(--muted);
  font-size: 0.9rem;
}

.stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

@media (min-width: 480px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 720px) {
  .stats {
    grid-template-columns: repeat(3, 1fr);
  }
}

.stat {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem;
  text-align: center;
}

.stat strong {
  display: block;
  font-size: 1.35rem;
  color: var(--accent);
}

.stat small {
  color: var(--muted);
  font-size: 0.8rem;
}

.upload-row {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.upload-row label {
  margin-bottom: 0.5rem;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -0.25rem;
}

table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th,
td {
  text-align: left;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

tr:hover td {
  background: rgba(61, 139, 253, 0.06);
}

.empty-hint {
  color: var(--muted);
  text-align: center;
  padding: 2rem 1rem;
}
