:root {
  --brand: #3157d5;
  --brand2: #203997;
  --ok: #07835f;
  --bad: #c4352d;
  --ink: #172033;
  --muted: #667085;
  --line: #e2e7f0;
  --bg: #f5f7fb;
  --card: #fff;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Microsoft YaHei", system-ui, sans-serif;
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
}
header {
  background: linear-gradient(125deg, #172b74, #3157d5 60%, #607fe7);
  color: #fff;
  box-shadow: 0 5px 22px #1e3a8a25;
}
.head,
main {
  width: min(1500px, calc(100% - 36px));
  margin: auto;
}
.head {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: #ffffff20;
  font-size: 22px;
}
.brand h1 {
  font-size: 20px;
  margin: 0;
}
.brand small {
  display: block;
  margin-top: 3px;
  color: #dbe4ff;
}
.head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
main {
  padding: 24px 0 44px;
  display: grid;
  gap: 16px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: 0 3px 16px #10182808;
}
.toolbar {
  padding: 20px;
}
.heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.heading h2 {
  margin: 0 0 4px;
  font-size: 17px;
}
.hint,
.meta {
  font-size: 12px;
  color: var(--muted);
}
.sources {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.source {
  padding: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.source-name {
  font-weight: 750;
}
.source-detail {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.pill {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3653b7;
  white-space: nowrap;
}
.pill.stale {
  background: #fff4e5;
  color: #a85708;
}
.search-row {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 180px auto auto auto auto;
  gap: 9px;
}
.control {
  width: 100%;
  border: 1px solid #ccd3df;
  border-radius: 10px;
  background: #fff;
  padding: 10px 12px;
  outline: none;
}
.control:focus {
  border-color: #6e88e7;
  box-shadow: 0 0 0 3px #3157d51a;
}
.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 15px;
  font-weight: 700;
  white-space: nowrap;
}
.primary {
  color: #fff;
  background: var(--brand);
}
.primary:hover {
  background: var(--brand2);
}
.secondary {
  color: #344054;
  background: #f3f5f9;
  border: 1px solid #dce1e9;
}
.success {
  color: #fff;
  background: var(--ok);
}
.ghost {
  color: #fff;
  background: #ffffff15;
  border: 1px solid #ffffff35;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 11px;
}
.stat {
  padding: 15px;
}
.stat .label {
  font-size: 12px;
  color: var(--muted);
}
.stat .value {
  font-size: 22px;
  font-weight: 800;
  margin-top: 5px;
}
.stat .value.money {
  color: var(--ok);
}
.table-card {
  overflow: hidden;
}
.table-head {
  padding: 14px 17px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.table-head h2 {
  font-size: 16px;
  margin: 0 0 4px;
}
.scroll {
  overflow: auto;
  max-height: 600px;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1400px;
}
th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #475467;
  text-align: left;
  font-size: 11px;
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td {
  font-size: 12px;
  padding: 11px;
  border-bottom: 1px solid #edf0f5;
  vertical-align: top;
}
tbody tr:hover {
  background: #fafbff;
}
.price {
  font-weight: 800;
  color: #c44c09;
  font-size: 14px;
}
.empty {
  text-align: center;
  color: var(--muted);
  padding: 48px 20px;
}
dialog {
  width: min(1100px, calc(100% - 28px));
  max-height: 88vh;
  padding: 0;
  border: 0;
  border-radius: 16px;
  box-shadow: 0 25px 80px #10182855;
}
dialog::backdrop {
  background: #10182880;
  backdrop-filter: blur(2px);
}
.modal-head {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #fff;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-head h2 {
  margin: 0;
  font-size: 18px;
}
.modal-body {
  padding: 18px 20px;
  overflow: auto;
}
.manage-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.panel {
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
}
.panel-title {
  padding: 12px 14px;
  background: #f8fafc;
  font-weight: 750;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.list-item {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.item-title {
  font-weight: 700;
}
.item-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  word-break: break-all;
}
.mini-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.mini {
  border: 1px solid #d8dee9;
  border-radius: 7px;
  background: #fff;
  padding: 5px 8px;
  font-size: 11px;
}
.mini.bad {
  color: var(--bad);
}
.form-card {
  margin-top: 14px;
  padding: 14px;
  background: #f8fafc;
  border-radius: 12px;
  display: none;
}
.form-card.open {
  display: block;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.form-grid .wide {
  grid-column: 1/-1;
}
.form-label {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin: 0 0 4px;
}
.form-actions {
  grid-column: 1/-1;
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 4px;
}
.target-row {
  display: flex;
  gap: 8px;
  margin: 14px 0;
}
.target-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.target {
  border: 1px solid #dce3ee;
  border-radius: 999px;
  padding: 6px 9px;
  background: #fff;
  font-size: 12px;
}
.target button {
  border: 0;
  background: none;
  color: var(--bad);
  padding: 0 0 0 5px;
}
.btn.warn {
  background: #fff4e5;
  color: #a85708;
  border: 1px solid #f3d3a6;
}
.mini.warn {
  background: #fff4e5;
  color: #a85708;
  border-color: #f3d3a6;
}
.pill.ok {
  background: #e8f7ee;
  color: #1f7a45;
}
.list-item.needs-attention {
  background: #fffaf2;
}
.target-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.target-table th,
.target-table td {
  padding: 9px 10px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}
.target-table th {
  color: var(--muted);
  font-weight: 600;
  border-top: 0;
}
.target-table tr.disabled td {
  color: var(--muted);
}
.target-table .mini-actions {
  justify-content: flex-start;
}
.toast {
  display: none;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2000;
  max-width: 450px;
  color: #fff;
  background: #344054;
  border-radius: 10px;
  padding: 12px 15px;
  box-shadow: 0 10px 30px #10182844;
}
.toast.show {
  display: block;
}
.toast.error {
  background: #b42318;
}
.toast.ok {
  background: #067557;
}
.loading {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1900;
  background: #10182855;
  place-items: center;
}
.loading.show {
  display: grid;
}
.loadbox {
  background: #fff;
  border-radius: 13px;
  padding: 23px 28px;
  text-align: center;
}
.spin {
  width: 34px;
  height: 34px;
  border: 4px solid #dce4ff;
  border-top-color: var(--brand);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@media (max-width: 950px) {
  .sources {
    grid-template-columns: 1fr;
  }
  .search-row {
    grid-template-columns: 1fr 1fr;
  }
  .search-row input {
    grid-column: 1/-1;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .manage-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 560px) {
  .head,
  main {
    width: calc(100% - 20px);
  }
  .brand small {
    display: none;
  }
  .search-row,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid .wide {
    grid-column: auto;
  }
  .head-actions .meta {
    display: none;
  }
}
