:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background: #f5f7fb;
  color: #172033;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.access-gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(245, 247, 251, 0.96);
}

.access-gate[hidden] {
  display: none;
}

.access-card {
  width: min(380px, 100%);
  display: grid;
  gap: 12px;
  padding: 24px;
  background: #fff;
  border: 1px solid #d9e1ef;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(16, 24, 40, 0.16);
}

.access-card h1 {
  margin: 0;
  font-size: 24px;
}

.access-card p {
  margin: 0;
  color: #667085;
}

.access-error {
  min-height: 20px;
  color: #b42318;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid #2457d6;
  background: #2457d6;
  color: #fff;
  min-height: 36px;
  border-radius: 6px;
  padding: 0 14px;
  cursor: pointer;
}

button.secondary {
  background: #fff;
  color: #2457d6;
}

input,
select {
  border: 1px solid #ccd5e6;
  border-radius: 6px;
  min-height: 36px;
  padding: 0 10px;
  background: #fff;
  color: #172033;
}

.topbar {
  min-height: 88px;
  padding: 18px 28px;
  background: #101828;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar h1,
.panel h2 {
  margin: 0;
}

.topbar h1 {
  font-size: 24px;
  font-weight: 700;
}

.topbar p {
  margin: 6px 0 0;
  color: #cbd5e1;
}

.topbar-actions,
.dialog-actions,
.upload-row,
.filters {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.shell {
  padding: 20px 28px 36px;
  display: grid;
  gap: 18px;
}

.panel {
  background: #fff;
  border: 1px solid #d9e1ef;
  border-radius: 8px;
  padding: 16px;
}

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

.panel h2 {
  font-size: 17px;
}

.checkline {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: #344054;
}

.upload-row input[type="text"] {
  min-width: 220px;
}

.status-line {
  min-height: 22px;
  margin-top: 10px;
  color: #475467;
}

.muted {
  color: #667085;
  font-size: 13px;
}

.quota-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 1px;
  border: 1px solid #d9e1ef;
  border-radius: 8px;
  overflow: hidden;
  background: #d9e1ef;
}

.quota-strip div {
  background: #fff;
  padding: 14px;
}

.quota-strip span {
  display: block;
  color: #667085;
  font-size: 13px;
}

.quota-strip strong {
  display: block;
  margin-top: 5px;
  font-size: 22px;
}

.result-head {
  align-items: flex-start;
}

.table-wrap {
  overflow: auto;
  border: 1px solid #e4eaf4;
  border-radius: 8px;
}

.table-wrap.compact {
  max-height: 260px;
}

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

.batch-table,
.usage-table {
  min-width: 0;
}

.batch-table th:first-child,
.batch-table td:first-child {
  width: 58%;
}

.batch-table th:nth-child(2),
.batch-table td:nth-child(2),
.batch-table th:nth-child(3),
.batch-table td:nth-child(3),
.batch-table th:nth-child(4),
.batch-table td:nth-child(4) {
  width: 11%;
}

.batch-table th:last-child,
.batch-table td:last-child {
  width: 18%;
  white-space: nowrap;
}

th,
td {
  border-bottom: 1px solid #e4eaf4;
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  background: #f8fafc;
  color: #344054;
  font-weight: 700;
  position: sticky;
  top: 0;
}

td .tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: #eef4ff;
  color: #2457d6;
  white-space: nowrap;
}

tr.selected-row td {
  background: #f0f6ff;
}

.tag.warn {
  background: #fff4e5;
  color: #b54708;
}

.tag.bad {
  background: #fee4e2;
  color: #b42318;
}

dialog {
  width: min(1180px, calc(100vw - 36px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(16, 24, 40, 0.28);
}

dialog::backdrop {
  background: rgba(16, 24, 40, 0.45);
}

.dialog-shell {
  padding: 0;
}

.dialog-head {
  padding: 16px 18px;
  border-bottom: 1px solid #e4eaf4;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dialog-head button {
  width: 36px;
  padding: 0;
  background: #fff;
  color: #172033;
  border-color: #ccd5e6;
}

.dialog-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.1fr);
  gap: 16px;
  padding: 16px 18px;
}

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

.field-grid label {
  display: grid;
  gap: 5px;
  color: #344054;
  font-size: 13px;
}

.field-grid input {
  width: 100%;
}

.preview-col iframe {
  width: 100%;
  height: 520px;
  border: 1px solid #d9e1ef;
  border-radius: 8px;
  background: #f8fafc;
}

details {
  margin: 0 18px 14px;
  border: 1px solid #e4eaf4;
  border-radius: 8px;
  padding: 10px 12px;
}

pre {
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 900px) {
  .topbar,
  .panel-head,
  .result-head {
    align-items: stretch;
    flex-direction: column;
  }

  .quota-strip,
  .grid-two,
  .dialog-grid {
    grid-template-columns: 1fr;
  }

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