:root {
  --primary: #1890ff;
  --primary-hover: #40a9ff;
  --success: #67c23a;
  --warning: #e6a23c;
  --danger: #f56c6c;
  --text: #303133;
  --body-text: #606266;
  --muted: #909399;
  --line: #dcdfe6;
  --soft-line: #ebeef5;
  --page: #f0f2f5;
  --surface: #fff;
  --sidebar: #304156;
  --sidebar-deep: #1f2d3d;
  --sidebar-hover: #263445;
  --tag-active: #42b983;
  font-family: Inter, 'PingFang SC', 'Microsoft YaHei', Arial, sans-serif;
  color-scheme: light;
}
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  scroll-padding-top: 108px;
}
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--page);
  font-size: 14px;
}
button,
input {
  font: inherit;
}
button {
  font-weight: 400;
}
.hidden {
  display: none !important;
}
.wordmark {
  color: var(--text);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.wordmark span {
  color: var(--muted);
  font-weight: 400;
}

.login {
  min-height: 100vh;
  padding: 28px 34px;
  background: linear-gradient(135deg, #f7f9fc, #eef3f8);
}
.login .wordmark {
  width: fit-content;
  padding: 10px 12px;
  color: #fff;
  background: var(--sidebar);
  border-radius: 4px;
}
.login .wordmark span {
  color: #d7e2ef;
}
.login form {
  width: min(440px, 100%);
  margin: 11vh auto 0;
  padding: 34px 36px;
  background: #fff;
  border: 1px solid var(--soft-line);
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(48, 65, 86, 0.1);
}
.tag {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
}
.login h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.35;
  font-weight: 500;
}
.intro {
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}
.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 22px;
}
.fields label {
  display: grid;
  gap: 7px;
  color: var(--body-text);
  font-size: 13px;
}
input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  outline: 0;
}
input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.12);
}
.login form > button {
  width: 100%;
  margin-top: 24px;
  padding: 10px 16px;
  color: #fff;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 4px;
  cursor: pointer;
}
.login form > button:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
.error {
  min-height: 20px;
  margin-bottom: 0;
  color: var(--danger);
  font-size: 13px;
}
.error:not(:empty) {
  padding: 10px 12px;
  background: #fff2f0;
  border: 1px solid #ffccc7;
  border-radius: 4px;
}

.portal-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
}
.portal-aside {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 210px;
  display: flex;
  flex-direction: column;
  color: #bfcbd9;
  background: var(--sidebar);
}
.aside-brand {
  min-height: 56px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  background: #2b2f3a;
}
.aside-brand span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--primary);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
}
.aside-brand strong {
  font-size: 15px;
  font-weight: 500;
}
.portal-aside nav {
  flex: 1;
  padding: 8px 0;
  overflow: auto;
}
.nav-item {
  min-height: 44px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  color: #bfcbd9;
  text-decoration: none;
  transition:
    background 0.15s,
    color 0.15s;
}
.nav-item::before {
  content: '';
  width: 5px;
  height: 5px;
  margin-right: 12px;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0.7;
}
.nav-item:hover {
  color: #fff;
  background: var(--sidebar-hover);
}
.nav-item.active {
  color: #409eff;
  background: var(--sidebar-deep);
}
.aside-foot {
  min-height: 44px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
}
.aside-foot i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
}
.portal-workspace {
  grid-column: 2;
  min-width: 0;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 12;
  height: 56px;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
}
.breadcrumb {
  display: flex;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
}
.breadcrumb span::after {
  content: '/';
  margin-left: 9px;
  color: #c0c4cc;
}
.breadcrumb b {
  color: var(--text);
  font-weight: 400;
}
.role {
  padding: 4px 8px;
  color: #67c23a;
  background: #f0f9eb;
  border: 1px solid #c2e7b0;
  border-radius: 4px;
  font-size: 11px;
}
.text-button,
.page button {
  margin-left: 8px;
  padding: 7px 11px;
  color: var(--body-text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}
.text-button:hover,
.page button:hover {
  color: var(--primary);
  background: #ecf5ff;
  border-color: #b3d8ff;
}
.tags-view {
  position: sticky;
  top: 56px;
  z-index: 11;
  height: 34px;
  padding: 4px 12px;
  display: flex;
  align-items: center;
  background: #fff;
  border-bottom: 1px solid #d8dce5;
}
.tags-view span {
  height: 26px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 2px;
  font-size: 12px;
}
.tags-view .active {
  color: #fff;
  background: var(--tag-active);
  border-color: var(--tag-active);
}
.tags-view .active::before {
  content: '';
  width: 7px;
  height: 7px;
  margin-right: 7px;
  background: #fff;
  border-radius: 50%;
}
main {
  width: 100%;
  max-width: 1440px;
  padding: 20px;
}
.hero {
  min-height: 170px;
  padding: 28px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
  background: linear-gradient(120deg, #1890ff, #36a3ff);
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(24, 144, 255, 0.18);
}
.hero .tag {
  color: rgba(255, 255, 255, 0.8);
}
.hero h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 500;
}
.hero p:not(.tag) {
  color: rgba(255, 255, 255, 0.78);
}
.hero-total {
  text-align: right;
}
.hero-total span {
  display: block;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
}
.hero-total strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  font-weight: 500;
}
.metrics {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.metric,
.account {
  position: relative;
  padding: 18px 20px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--soft-line);
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 21, 41, 0.04);
}
.metric::before,
.account::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--primary);
}
.metric span,
.account span {
  color: var(--muted);
  font-size: 12px;
}
.metric strong,
.account strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 22px;
  font-weight: 500;
}
.metric small,
.account small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
}
.accounts,
.orders,
.integration {
  margin-top: 20px;
  scroll-margin-top: 108px;
}
.section-head {
  min-height: 40px;
  margin-bottom: 8px;
  display: flex;
  align-items: end;
  justify-content: space-between;
}
.section-head .tag {
  margin-bottom: 3px;
}
.section-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 500;
}
.account-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.table-wrap {
  width: 100%;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
}
table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}
th,
td {
  padding: 11px 12px;
  color: var(--body-text);
  text-align: left;
  border-right: 1px solid var(--soft-line);
  border-bottom: 1px solid var(--soft-line);
  font-size: 12px;
  white-space: nowrap;
}
th:last-child,
td:last-child {
  border-right: 0;
}
tr:last-child td {
  border-bottom: 0;
}
th {
  background: #f5f7fa;
  font-weight: 500;
}
tbody tr:hover {
  background: #f5f7fa;
}
tr[data-id] {
  cursor: pointer;
}
.status {
  padding: 2px 7px;
  color: var(--body-text);
  background: #f4f4f5;
  border: 1px solid #d3d4d6;
  border-radius: 4px;
  font-size: 11px;
}
.status.SUCCEEDED,
.status.ACTIVE,
.status.COMPLETED {
  color: #67c23a;
  background: #f0f9eb;
  border-color: #c2e7b0;
}
.status.UNKNOWN,
.status.MANUAL_REVIEW {
  color: #e6a23c;
  background: #fdf6ec;
  border-color: #f5dab1;
}
.status.FAILED,
.status.EXPIRED_UNPAID {
  color: #f56c6c;
  background: #fef0f0;
  border-color: #fbc4c4;
}
.page {
  margin-top: 12px;
  text-align: right;
}
.integration-note {
  padding: 10px 12px;
  color: var(--body-text);
  background: #f4f4f5;
  border-left: 3px solid var(--primary);
  border-radius: 0 4px 4px 0;
  font-size: 12px;
  line-height: 1.6;
}
.integration-credentials {
  margin-top: 12px;
}
pre {
  overflow: auto;
  white-space: pre;
}
dialog {
  width: min(760px, calc(100vw - 30px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.18);
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}
.detail-head {
  padding: 15px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.detail-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 500;
}
.detail-head button {
  color: var(--muted);
  background: transparent;
  border: 0;
  font-size: 22px;
  cursor: pointer;
}
.facts {
  margin: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.facts div {
  padding: 12px;
  border-right: 1px solid var(--soft-line);
  border-bottom: 1px solid var(--soft-line);
}
.facts small {
  color: var(--muted);
}
.facts p {
  font-size: 12px;
  word-break: break-all;
}
.attempts {
  padding: 0 18px 18px;
}
.notice {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  padding: 11px 15px;
  color: #fff;
  background: #303133;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  font-size: 12px;
}
.notice.error-notice {
  color: #a8071a;
  background: #fff2f0;
  border: 1px solid #ffccc7;
}

@media (max-width: 900px) {
  .metrics,
  .account-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 720px) {
  .login {
    padding: 20px;
  }
  .login form {
    padding: 28px;
  }
  .fields {
    grid-template-columns: 1fr;
  }
  .portal-shell {
    grid-template-columns: 64px minmax(0, 1fr);
  }
  .portal-aside {
    width: 64px;
  }
  .portal-workspace {
    grid-column: 2;
  }
  .aside-brand {
    padding: 0 16px;
  }
  .aside-brand strong,
  .aside-foot span {
    display: none;
  }
  .nav-item {
    padding: 0;
    justify-content: center;
    font-size: 0;
  }
  .nav-item::before {
    width: 8px;
    height: 8px;
    margin: 0;
  }
  .topbar {
    padding: 0 12px;
  }
  .breadcrumb span {
    display: none;
  }
  main {
    padding: 12px;
  }
  .hero {
    display: block;
    padding: 22px;
  }
  .hero-total {
    margin-top: 28px;
    text-align: left;
  }
  .facts {
    grid-template-columns: 1fr;
  }
}
