:root {
  --primary: #165dff;
  --primary-hover: #4080ff;
  --primary-active: #0e42d2;
  --primary-light: #e8f3ff;
  --success: #00b42a;
  --success-light: #e8ffea;
  --warning: #ff7d00;
  --warning-light: #fff7e8;
  --danger: #f53f3f;
  --danger-light: #ffece8;
  --text-1: #1d2129;
  --text-2: #4e5969;
  --text-3: #86909c;
  --text-4: #c9cdd4;
  --fill-1: #f7f8fa;
  --fill-2: #f2f3f5;
  --fill-3: #e5e6eb;
  --border: #e5e6eb;
  --bg: #f2f3f5;
  --card: #ffffff;
  --radius: 4px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px; line-height: 1.5715; color: var(--text-1); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* layout */
.layout { display: flex; flex-direction: column; min-height: 100vh; }
.header {
  height: 60px; background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 20px; gap: 12px; position: sticky; top: 0; z-index: 10;
}
.logo { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 500; }
.logo-mark {
  width: 28px; height: 28px; border-radius: 6px; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600;
}
.header .spacer { flex: 1; }
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 500;
}
.body { display: flex; flex: 1; min-height: 0; }
.sider { width: 208px; background: var(--card); border-right: 1px solid var(--border); padding: 8px; flex-shrink: 0; }
.menu-item {
  display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; margin-bottom: 4px;
  border-radius: var(--radius); color: var(--text-2); cursor: pointer; user-select: none; border: 0; background: none; width: 100%; text-align: left;
}
.menu-item:hover { background: var(--fill-2); color: var(--text-1); }
.menu-item.active { background: var(--primary-light); color: var(--primary); font-weight: 500; }
.menu-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.content { flex: 1; padding: 16px 20px 40px; min-width: 0; }
.page-title { font-size: 20px; font-weight: 500; margin: 4px 0 16px; }
.breadcrumb { color: var(--text-3); font-size: 12px; margin-top: 4px; }

/* cards */
.card { background: var(--card); border-radius: var(--radius); margin-bottom: 16px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px 0; font-size: 16px; font-weight: 500;
}
.card-head .extra { font-size: 14px; font-weight: 400; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 16px 20px 20px; }
.desc { color: var(--text-3); font-size: 12px; margin-top: 4px; font-weight: 400; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 16px 20px; }
.stat .label { color: var(--text-2); font-size: 12px; }
.stat .value { font-size: 24px; font-weight: 500; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .value.ok { color: var(--success); }
.stat .value.warn { color: var(--warning); }

/* form */
.form-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 160px; }
.field.grow { flex: 1; }
.field label, .field-label { color: var(--text-2); font-size: 14px; }
.input, .select, .textarea {
  height: 32px; padding: 0 12px; border: 1px solid transparent; border-radius: 2px; background: var(--fill-2);
  outline: none; transition: all .1s;
}
.input:hover, .select:hover, .textarea:hover { background: var(--fill-3); }
.input:focus, .select:focus, .textarea:focus { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-light); }
.select { padding-right: 28px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2386909c' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.select.sm { height: 28px; font-size: 13px; }
.textarea { width: 100%; margin-bottom: 12px; height: auto; min-height: 120px; padding: 8px 12px; resize: vertical; font-family: ui-monospace, Menlo, monospace; font-size: 12px; line-height: 1.6; }
.hint { color: var(--text-3); font-size: 12px; }

/* buttons */
.btn {
  height: 32px; padding: 0 15px; border-radius: 2px; border: 1px solid transparent; cursor: pointer;
  background: var(--fill-2); color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; transition: all .1s;
}
.btn:hover { background: var(--fill-3); }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.primary:active { background: var(--primary-active); }
.btn.outline { background: #fff; border-color: var(--primary); color: var(--primary); }
.btn.outline:hover { border-color: var(--primary-hover); color: var(--primary-hover); }
.btn.danger { background: var(--danger-light); color: var(--danger); }
.btn.sm { height: 24px; padding: 0 8px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; color: var(--primary); cursor: pointer; padding: 0 4px; font-size: 13px; }
.link-btn:hover { color: var(--primary-hover); }
.link-btn.danger { color: var(--danger); }
.link-btn[disabled] { color: var(--text-4); cursor: not-allowed; }
.spin { width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-weight: 500; color: var(--text-2); background: var(--fill-1);
  padding: 9px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; font-size: 14px;
}
td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: var(--fill-1); }
td.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--text-2); }
td.muted, .muted { color: var(--text-3); }
.empty { text-align: center; color: var(--text-3); padding: 32px 0; }
.cell-actions { display: flex; gap: 4px; align-items: center; flex-wrap: nowrap; white-space: nowrap; }
td:first-child { white-space: nowrap; }
.form-row .grow { flex: 1; }
.clip { display: inline-block; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.ellipsis { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle; }

/* tags */
.tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 2px; font-size: 12px; background: var(--fill-2); color: var(--text-2); white-space: nowrap; }
.tag.blue { background: var(--primary-light); color: var(--primary); }
.tag.green { background: var(--success-light); color: var(--success); }
.tag.orange { background: var(--warning-light); color: var(--warning); }
.tag.red { background: var(--danger-light); color: var(--danger); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* alert */
.alert { display: flex; gap: 8px; padding: 9px 16px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px; background: var(--primary-light); color: var(--text-1); }
.alert.warn { background: var(--warning-light); }
.alert b { font-weight: 500; }

/* steps */
.steps { display: flex; gap: 0; margin-bottom: 4px; }
.step { flex: 1; display: flex; align-items: flex-start; gap: 10px; }
.step-num {
  width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 12px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.step-title { font-weight: 500; }
.step-desc { color: var(--text-3); font-size: 12px; }

/* login */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 16px; }
.login-box { width: 380px; max-width: 100%; background: #fff; border-radius: 8px; padding: 40px 36px; }
.login-box h1 { font-size: 22px; font-weight: 500; margin: 16px 0 4px; }
.login-box .sub { color: var(--text-3); margin-bottom: 28px; }
.login-box .field { margin-bottom: 18px; }
.login-box .btn { width: 100%; justify-content: center; height: 36px; }
.err { color: var(--danger); font-size: 12px; min-height: 18px; }

/* toast */
.toasts { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 9px 16px; box-shadow: 0 4px 10px rgba(0,0,0,.1); display: flex; gap: 8px; align-items: center; font-size: 14px; }
.toast.ok .dot { color: var(--success); }
.toast.err .dot { color: var(--danger); }
.toast.info .dot { color: var(--primary); }

/* drawer-like inline panel */
.panel { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; background: var(--fill-1); }
.panel-title { font-weight: 500; margin-bottom: 12px; }
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: 36px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 4px 10px rgba(0,0,0,.1); min-width: 140px; padding: 4px; z-index: 20; }
.dropdown-menu button { width: 100%; text-align: left; height: 32px; padding: 0 12px; border: 0; background: none; cursor: pointer; border-radius: 2px; }
.dropdown-menu button:hover { background: var(--fill-2); }
.hidden { display: none !important; }
.hidden-copy { position: fixed; top: 0; left: 0; opacity: 0; pointer-events: none; }

@media (max-width: 900px) {
  .sider { width: 64px; }
  .menu-item span { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .steps { flex-direction: column; gap: 10px; }
}
@media (max-width: 560px) {
  .body { flex-direction: column; }
  .sider { width: 100%; display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .menu-item { width: auto; margin: 0 4px 0 0; }
  .content { padding: 12px 12px 32px; }
  .header { padding: 0 12px; }
}
