:root {
  --blue: #2563ff;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #101936;
  --muted: #687593;
  --line: #e7edf7;
  --green: #16a34a;
  --orange: #f59e0b;
  --red: #ef4444;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}
button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 20% 10%, #e9f2ff 0, transparent 360px), #f7f9fd;
}
.login-card {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(31, 41, 55, .08);
}
.login-card h1 { margin: 0 0 6px; font-size: 28px; }
.login-card p { margin: 0 0 22px; color: var(--muted); }
.login-card label, .form-grid label, .stack label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}
input, select, textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
}
input:disabled, select:disabled, textarea:disabled {
  color: #94a3b8;
  background: #f1f5f9;
  cursor: not-allowed;
}
label small {
  color: var(--muted);
  line-height: 1.5;
}
textarea { min-height: 84px; resize: vertical; }
.primary {
  min-height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  color: #fff;
  background: var(--blue);
  font-weight: 700;
}
.ghost {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--blue);
  background: #eef4ff;
  font-weight: 700;
}
.danger {
  color: #fff;
  background: var(--red);
}
.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px 1fr;
}
.side {
  padding: 18px 14px;
  color: #d7def0;
  background: #101936;
}
.brand {
  margin-bottom: 20px;
  padding: 10px 8px;
  color: #fff;
  font-size: 20px;
  font-weight: 900;
}
.nav button {
  width: 100%;
  height: 40px;
  margin-bottom: 6px;
  border-radius: 8px;
  padding: 0 12px;
  color: #cbd5e1;
  background: transparent;
  text-align: left;
}
.nav button.active, .nav button:hover {
  color: #fff;
  background: var(--blue);
}
.main {
  min-width: 0;
  padding: 24px;
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}
.top h1 { margin: 0 0 6px; font-size: 28px; }
.top p { margin: 0; color: var(--muted); }
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.card, .panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(31, 41, 55, .05);
}
.card { padding: 18px; }
.card span { display: block; color: var(--muted); }
.card b { display: block; margin-top: 10px; font-size: 28px; }
.panel { margin-top: 16px; overflow: hidden; }
.hint-box {
  margin: 16px 16px 0;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eff6ff;
  color: #1e3a8a;
}
.hint-box b, .hint-box span {
  display: block;
}
.hint-box span {
  margin-top: 6px;
  line-height: 1.6;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { margin: 0; font-size: 18px; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table-scroll {
  width: 100%;
  overflow-x: auto;
}
.table-scroll table {
  min-width: 860px;
}
th, td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
td {
  max-width: 260px;
}
td:nth-child(2) {
  min-width: 150px;
}
th { color: var(--muted); font-weight: 600; background: #fafcff; }
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--blue);
  background: #eef4ff;
  font-size: 12px;
  font-weight: 700;
}
.avatar-cell, .avatar-img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, #2f73ff, #16a34a);
  font-size: 14px;
  font-weight: 900;
  vertical-align: middle;
}
.avatar-img {
  object-fit: cover;
  background: #eef4ff;
}
.ok { color: var(--green); }
.warn { color: var(--orange); }
.bad { color: var(--red); }
.grid-2 {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 16px;
  align-items: start;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}
.form-grid .full { grid-column: 1 / -1; }
.upload-inline {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}
.file-preview-card {
  min-height: 76px;
  padding: 12px;
  border: 1px dashed #b9c8e6;
  border-radius: 10px;
  background: #f8fbff;
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 12px;
  align-items: center;
}
.file-preview-card.done {
  border-color: #86efac;
  background: #f0fdf4;
}
.file-preview-card.uploading {
  border-color: #bfdbfe;
  background: #eff6ff;
}
.file-preview-card.failed {
  border-color: #fecaca;
  background: #fef2f2;
}
.file-preview-card b, .file-preview-card span {
  display: block;
}
.file-preview-card span {
  margin-top: 5px;
  color: var(--muted);
}
.file-thumb {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, #2563ff, #16a34a);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
}
.file-upload-action {
  white-space: nowrap;
}
.upload-ok {
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  color: #15803d;
  background: #dcfce7;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}
.file-mini {
  display: grid;
  grid-template-columns: 36px minmax(100px, 1fr);
  gap: 8px;
  align-items: center;
}
.file-mini b {
  min-width: 36px;
  height: 28px;
  border-radius: 7px;
  color: #fff;
  background: #2563ff;
  display: grid;
  place-items: center;
  font-size: 11px;
}
.file-mini span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-hint {
  min-height: 38px;
  padding: 9px 10px;
  border: 1px dashed #c8d5ef;
  border-radius: 8px;
  color: var(--muted);
  background: #f8fbff;
}
.preview-image-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
  min-height: 0;
}
.preview-image-list:not(:empty) {
  padding: 10px;
  border: 1px dashed #86efac;
  border-radius: 10px;
  background: #f0fdf4;
}
.preview-image-list figure {
  width: 96px;
  margin: 0;
  position: relative;
}
.preview-image-list img {
  width: 96px;
  height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: #f8fbff;
  display: block;
}
.preview-image-list button {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #fff;
  background: var(--red);
  font-weight: 900;
  line-height: 22px;
}
.preview-image-list figcaption {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.table-preview {
  display: flex;
  align-items: center;
  gap: 6px;
}
.table-preview img {
  width: 42px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #f8fbff;
}
.table-preview span {
  color: var(--blue);
  font-weight: 700;
  white-space: nowrap;
}
.stack { padding: 16px; }
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 420px;
  padding: 12px 16px;
  border-radius: 10px;
  color: #fff;
  background: rgba(15, 23, 42, .92);
  box-shadow: 0 16px 40px rgba(15, 23, 42, .18);
}
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, .42);
}
.modal {
  width: min(560px, 100%);
  max-height: min(760px, 92vh);
  overflow: auto;
  padding: 18px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(15, 23, 42, .24);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.modal-head h2 { margin: 0; }
.modal-head button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--muted);
  background: #f1f5f9;
  font-size: 20px;
}
.modal label {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}
.empty {
  padding: 42px;
  color: var(--muted);
  text-align: center;
}
.compact-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.search {
  max-width: 260px;
}
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 2; display: flex; gap: 10px; overflow-x: auto; align-items: center; }
  .brand { flex: 0 0 auto; margin: 0; }
  .nav { display: flex; gap: 8px; }
  .nav button { width: auto; margin: 0; white-space: nowrap; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .main { padding: 16px; }
}
