:root {
  --sidebar-width: 220px;
  --sidebar-collapsed: 64px;
  --dark: #171923;
  --dark-deep: #10121a;
  --dark-hover: #242838;
  --blue: #4b6fff;
  --blue-dark: #3563ff;
  --line: #ebeef5;
  --text: #1f2329;
  --muted: #77808f;
  --bg: #f5f7fb;
  --success: #45b864;
  --danger: #f56c6c;
  --warning: #e6a23c;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; }
body { overflow: hidden; color: var(--text); background: var(--bg); font-size: 14px; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }

.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  height: 100vh;
  min-width: 1180px;
}
.app.is-collapsed { grid-template-columns: var(--sidebar-collapsed) minmax(0, 1fr); }

.sidebar {
  background: var(--dark);
  color: #d7dce6;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.brand {
  height: 60px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
}
.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, #6aa2ff, #3158ff);
}
.brand-text strong, .brand-text span { display: block; line-height: 1.1; }
.brand-text strong { color: #fff; font-size: 16px; }
.brand-text span { margin-top: 6px; color: #b4bac8; font-size: 13px; font-weight: 700; }

.nav-list { padding: 4px 18px 20px; overflow: auto; }
.nav-group { margin-bottom: 8px; }
.nav-parent, .nav-child {
  width: 100%;
  border: 0;
  color: inherit;
  background: transparent;
  display: flex;
  align-items: center;
  text-align: left;
}
.nav-parent {
  min-height: 48px;
  padding: 0 10px;
  gap: 12px;
  border-radius: 4px;
}
.nav-parent:hover, .nav-child:hover { background: var(--dark-hover); }
.nav-parent.is-active, .nav-child.is-active {
  color: #fff;
  background: var(--blue);
}
.nav-parent.is-parent-active { color: #fff; }
.nav-icon {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
}
.nav-label { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.nav-arrow { margin-left: auto; color: #aab1bf; font-size: 18px; }
.nav-children { display: none; padding: 2px 0 4px 28px; }
.nav-group.is-open .nav-children { display: block; }
.nav-child {
  min-height: 40px;
  padding: 0 10px;
  gap: 10px;
  color: #d2d7e2;
  border-radius: 4px;
  font-size: 13px;
}
.nav-child::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #616878;
}
.nav-child.is-active::before { background: #fff; }
.app.is-collapsed .brand-text, .app.is-collapsed .nav-label, .app.is-collapsed .nav-arrow, .app.is-collapsed .nav-children { display: none; }
.app.is-collapsed .brand { padding: 10px 13px; }
.app.is-collapsed .nav-list { padding: 8px; }
.app.is-collapsed .nav-parent { justify-content: center; padding: 0; }

.workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 60px 41px minmax(0, 1fr);
}
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.breadcrumb { color: #596273; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.icon-button {
  min-width: 30px;
  height: 30px;
  border: 0;
  border-radius: 4px;
  color: #606a7a;
  background: transparent;
}
.icon-button:hover { background: #f1f4f9; }
.user-profile {
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #303642;
}
.avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, #d8c0a2, #9b6e52);
}
.tabs {
  display: flex;
  align-items: stretch;
  background: #fff;
  border-bottom: 1px solid var(--line);
  overflow: auto hidden;
}
.tab {
  min-width: 86px;
  border: 0;
  border-right: 1px solid var(--line);
  color: #5f6878;
  background: #fff;
  padding: 0 18px;
}
.tab.is-active { color: var(--blue); background: #eef4ff; }
.tab-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: currentColor;
}

.content { overflow: auto; padding: 24px 18px 40px; }
.page-card { min-height: calc(100vh - 150px); }
h1 { margin: 4px 0 28px; font-size: 20px; }
h2 { margin: 0 0 18px; font-size: 18px; }
.info-box, .table-shell, .notice-line {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.info-box { padding: 18px; }
.merchant-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 32px;
  max-width: 1220px;
}
.merchant-info span { color: #606a7a; margin-right: 12px; }
.inline-icon {
  margin-left: 6px;
  border: 0;
  color: #606a7a;
  background: transparent;
}

.notice-line {
  margin-bottom: 12px;
  padding: 12px 16px;
  color: #8a651f;
  background: #fff8e8;
  border-color: #f6dfae;
}
.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px 18px;
  margin-bottom: 14px;
  padding: 14px 0;
}
.field {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #4d5666;
}
.field span { white-space: nowrap; }
.field input, .field textarea, .select-like, .combo {
  height: 32px;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  background: #fff;
}
.field input { width: 180px; padding: 0 10px; }
.field.wide input { width: 330px; }
.combo { display: flex; overflow: hidden; }
.combo button, .select-like {
  border: 0;
  padding: 0 12px;
  color: #606a7a;
  background: #fff;
}
.combo input { width: 150px; border: 0; border-left: 1px solid #dcdfe6; }
.filter-actions { display: flex; gap: 10px; }
.primary-button, .plain-button {
  min-width: 64px;
  height: 32px;
  padding: 0 14px;
  border-radius: 4px;
}
.primary-button {
  color: #fff;
  border: 1px solid var(--blue-dark);
  background: var(--blue);
}
.plain-button {
  color: #606a7a;
  border: 1px solid #dcdfe6;
  background: #fff;
}
.summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 28px;
  margin-bottom: 14px;
  color: #4d5666;
}
.summary-row strong { margin-left: 4px; color: #1f2329; }

.table-shell {
  width: 100%;
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  table-layout: fixed;
}
th, td {
  min-width: 120px;
  height: 53px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  color: #303642;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
th {
  color: #606a7a;
  background: #f7f9fc;
  font-weight: 700;
}
.empty {
  height: 58px;
  color: #9098a7;
  text-align: center;
}
.link-button {
  border: 0;
  color: var(--blue);
  background: transparent;
  padding: 0 5px;
}
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 12px;
}
.tag.success { color: #219653; background: #eef9f1; }
.tag.danger { color: #d94f4f; background: #fff0f0; }
.tag.warning { color: #b77b11; background: #fff7e8; }
.pagination {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  color: #606a7a;
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
}
.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
}
.modal-card {
  position: absolute;
  top: 120px;
  left: 50%;
  transform: translateX(-50%);
  width: min(760px, calc(100vw - 48px));
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 18px 48px rgba(20, 28, 45, 0.25);
}
.modal-card header, .modal-card footer {
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
}
.modal-card header h2 { margin: 0; font-size: 17px; }
.modal-card header button { margin-left: auto; }
.modal-card footer {
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}
.modal-body { padding: 20px; max-height: 58vh; overflow: auto; }
.detail-grid, .form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}
.field.full { grid-column: 1 / -1; align-items: flex-start; }
.field.full textarea {
  width: 100%;
  min-height: 86px;
  padding: 8px 10px;
}
.tree-box {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #fbfcfe;
}
.secret-box {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: #f7f9fc;
  border-radius: 4px;
}
.toast {
  position: fixed;
  right: 24px;
  top: 76px;
  z-index: 30;
  transform: translateY(-12px);
  opacity: 0;
  padding: 10px 16px;
  border-radius: 4px;
  color: #1f6f3b;
  background: #edf8f0;
  border: 1px solid #c9efd4;
  transition: 0.2s ease;
}
.toast.is-show { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .app { min-width: 0; grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 10; width: 220px; transform: translateX(-100%); }
  .workspace { grid-column: 1; }
  .merchant-info, .detail-grid, .form-grid { grid-template-columns: 1fr; }
}
