:root {
  font-family: Inter, ui-sans-serif, system-ui, "PingFang SC", sans-serif;
  color: #162033;
  background: #f3f5f9;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
main {
  max-width: 1560px;
  margin: auto;
  padding: 24px;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  margin-bottom: 5px;
  font-size: 28px;
}
h2 {
  margin-bottom: 5px;
}
header p {
  margin: 0;
  color: #778195;
}
.token,
.header-actions,
.task-actions,
.filters,
.actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
input,
select,
button {
  border: 1px solid #d8dee9;
  border-radius: 9px;
  padding: 9px 12px;
  background: #fff;
  color: inherit;
  font: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: wait;
  opacity: 0.55;
}
button.primary {
  background: #315efb;
  color: #fff;
  border-color: #315efb;
}
button.danger {
  color: #bd2635;
}
.panel,
.stat {
  background: #fff;
  border: 1px solid #e2e6ed;
  border-radius: 14px;
  box-shadow: 0 3px 16px #17233b0a;
}
.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin: 20px 0;
}
.stat {
  padding: 15px 18px;
}
.stat b {
  display: block;
  font-size: 24px;
}
.stat span,
.muted {
  color: #8791a2;
  font-size: 13px;
}
.workspace {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.sidebar {
  padding: 14px;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
}
.sidebar-head,
.instance-header,
.toolbar,
.instance-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.sidebar-head {
  padding: 4px 4px 12px;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8a94a6;
  font-size: 10px;
  font-weight: 700;
}
.icon-button {
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 22px;
}
.instance-list {
  display: grid;
  gap: 7px;
}
.instance-card {
  display: block;
  width: 100%;
  padding: 12px;
  text-align: left;
  background: #fff;
  border-color: transparent;
}
.instance-card:hover {
  background: #f5f7fb;
}
.instance-card.selected {
  background: #eef3ff;
  border-color: #9db3ff;
  box-shadow: inset 3px 0 #315efb;
}
.instance-card-top {
  margin-bottom: 6px;
}
.instance-url,
.instance-meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #7f899a;
  font-size: 12px;
}
.instance-meta {
  margin-top: 3px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ba4b2;
}
.status-dot.online {
  background: #13a465;
}
.status-dot.offline {
  background: #dc4453;
}
.content {
  padding: 20px;
  min-height: 510px;
}
.instance-header {
  padding-bottom: 18px;
  border-bottom: 1px solid #edf0f4;
}
.toolbar {
  margin-top: 16px;
}
.filters input {
  width: 270px;
}
.task-progress {
  margin-top: 9px;
  padding: 9px 12px;
  border-radius: 8px;
  background: #f3f6fd;
  color: #52617a;
  font-size: 13px;
}
.task-progress:empty {
  display: none;
}
.table-wrap {
  overflow: auto;
  margin-top: 12px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th,
td {
  text-align: left;
  padding: 12px 9px;
  border-bottom: 1px solid #edf0f4;
  white-space: nowrap;
  vertical-align: middle;
}
th {
  color: #727d8f;
  font-size: 12px;
}
.filename {
  max-width: 330px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: #edf0f5;
  font-size: 12px;
  font-weight: 500;
}
.online {
  background: #e7f8ef;
  color: #087a45;
}
.offline,
.disabled {
  background: #fff0f1;
  color: #b42332;
}
.quota-summary {
  min-width: 205px;
  white-space: nowrap;
}
.quota-meter {
  display: inline-block;
  width: 58px;
  height: 6px;
  margin-right: 6px;
  border-radius: 8px;
  background: #e5e9f0;
  overflow: hidden;
  vertical-align: middle;
}
.quota-meter span {
  display: block;
  height: 100%;
  background: #315efb;
}
.upload-zone {
  display: grid;
  gap: 5px;
  padding: 24px;
  border: 1px dashed #aab8d5;
  border-radius: 12px;
  text-align: center;
  background: #f7f9fd;
  cursor: pointer;
}
.upload-zone:hover {
  border-color: #315efb;
  background: #f1f5ff;
}
.upload-zone input {
  display: none;
}
.upload-zone span {
  font-size: 12px;
  color: #818c9f;
}
.selected-files {
  max-height: 180px;
  overflow: auto;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f5f7fa;
  line-height: 1.65;
}
.upload-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.link-button {
  padding: 4px 7px;
  border: 0;
  color: #315efb;
  background: transparent;
}
.upload-targets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  max-height: 210px;
  overflow: auto;
}
.upload-target {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px;
  border: 1px solid #dde3ec;
  border-radius: 9px;
  cursor: pointer;
}
.upload-target.selected {
  border-color: #7997ff;
  background: #eef3ff;
}
.upload-target input {
  margin-top: 3px;
}
.upload-target span,
.upload-target small {
  display: block;
  min-width: 0;
}
.upload-target small {
  margin-top: 3px;
  color: #818b9c;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-results {
  display: grid;
  gap: 6px;
  max-height: 180px;
  overflow: auto;
}
.upload-result {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
}
.upload-result.success {
  background: #eaf8f0;
  color: #087a45;
}
.upload-result.failed {
  background: #fff0f1;
  color: #b42332;
}
.empty-state {
  text-align: center;
  padding: 145px 20px;
  color: #818b9b;
}
.empty-state h2 {
  color: #344056;
}
.empty-mini,
.empty-row {
  text-align: center;
  color: #8c96a7;
  padding: 24px;
}
dialog {
  border: 0;
  border-radius: 14px;
  padding: 22px;
  width: min(540px, 92vw);
  box-shadow: 0 20px 80px #0003;
}
dialog form {
  display: grid;
  gap: 12px;
}
#toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: #172033;
  color: #fff;
  padding: 12px 16px;
  border-radius: 9px;
  display: none;
  z-index: 20;
}
@media (max-width: 980px) {
  main {
    padding: 14px;
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    max-height: none;
  }
  .instance-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .toolbar,
  .instance-header {
    align-items: flex-start;
    flex-direction: column;
  }
  .filters {
    width: 100%;
  }
  .filters input {
    flex: 1;
    width: auto;
  }
}
@media (max-width: 620px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  header {
    align-items: flex-start;
    flex-direction: column;
  }
  .token {
    width: 100%;
  }
  .token input {
    flex: 1;
  }
  .instance-list,
  .upload-targets {
    grid-template-columns: 1fr;
  }
  .task-actions,
  .filters {
    align-items: stretch;
    flex-direction: column;
  }
  .header-actions {
    flex-wrap: wrap;
  }
}
