:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #1a2332;
  --muted: #5c6b7a;
  --line: #d8e0e8;
  --accent: #0b6e4f;
  --accent-hover: #095c42;
  --danger: #b42318;
  --error-bg: #fef3f2;
  --ok-bg: #ecfdf3;
  --font: "Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, #d9ebe3 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, #e4ecf5 0%, transparent 50%),
    var(--bg);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.5rem;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand a {
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.topbar nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  font-size: 0.92rem;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.batch-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.batch-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.batch-form {
  margin-top: 1rem;
}

.batch-form input[type="file"] {
  padding: 0.55rem 0;
  border: 0;
  background: transparent;
}

.import-errors {
  margin: 0.75rem 0 1.25rem;
  padding: 0.85rem 1rem;
  background: var(--error-bg);
  border: 1px solid #fecdca;
  border-radius: 8px;
}

.import-errors summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--danger);
}

.import-errors ul {
  margin: 0.6rem 0 0;
  padding-left: 1.25rem;
  color: var(--ink);
  font-size: 0.9rem;
}

h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
}

.muted { color: var(--muted); font-size: 0.9rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover { background: #f0f3f6; text-decoration: none; }

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

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

.btn.ghost { background: transparent; }

.btn.danger, button.danger {
  color: var(--danger);
}

.linkish {
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0;
}

.topbar .linkish { color: var(--muted); }
.actions .danger { color: var(--danger); }

.flash {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
}

.flash-ok, .flash-success { background: var(--ok-bg); border-color: #abefc6; }
.flash-error { background: var(--error-bg); border-color: #fecdca; color: var(--danger); }

.search-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.search-bar input[type="search"] {
  flex: 1;
  min-width: 200px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

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

th {
  background: #f7fafc;
  font-weight: 600;
  white-space: nowrap;
}

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

.nowrap { white-space: nowrap; }

.tag {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  background: #eef2f6;
  font-size: 0.78rem;
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  white-space: nowrap;
}

.actions form { display: inline; margin: 0; }

.list-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.list-meta .muted { margin: 0; }

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.pager-bottom {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}

.pager-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.55rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  color: var(--ink);
  font-size: 0.88rem;
  text-decoration: none;
  line-height: 1;
}

a.pager-btn:hover {
  background: #eef5f1;
  border-color: #b7d4c6;
  text-decoration: none;
}

.pager-btn.current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.pager-btn.disabled {
  color: #a0aab4;
  background: #f7f9fb;
  cursor: not-allowed;
}

.pager-ellipsis {
  min-width: 1.25rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}

.login-card {
  max-width: 380px;
  margin: 4rem auto;
  padding: 1.75rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(26, 35, 50, 0.06);
}

.login-card h1 { margin-bottom: 0.25rem; }

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 1.25rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
}

input, textarea, select {
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

textarea { resize: vertical; line-height: 1.5; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.25rem;
}

.form-grid .full { grid-column: 1 / -1; }

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.inline { display: inline; margin: 0; }

@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; }
}
