:root {
  --yx-primary: #2563eb;
  --yx-primary-dark: #1d4ed8;
  --yx-primary-light: #eff6ff;
  --yx-bg: #f8fafc;
  --yx-card: #ffffff;
  --yx-text: #1e293b;
  --yx-muted: #64748b;
  --yx-border: #e8ecf3;
  --yx-radius: 14px;
  --yx-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px rgba(16, 24, 40, .06);
}

* { -webkit-tap-highlight-color: transparent; }

body {
  background: var(--yx-bg);
  color: var(--yx-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  padding-bottom: env(safe-area-inset-bottom);
}

a { text-decoration: none; }

/* 顶部导航 */
.yx-navbar {
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--yx-border);
  position: sticky;
  top: 0;
  z-index: 1030;
}
.yx-brand { font-weight: 700; font-size: 17px; color: var(--yx-text); letter-spacing: .3px; }
.yx-brand i { color: var(--yx-primary); }
.yx-navbar .nav-link { color: var(--yx-muted); font-size: 14px; padding: .35rem .8rem; border-radius: 8px; }
.yx-navbar .nav-link.active, .yx-navbar .nav-link:hover { color: var(--yx-primary); background: var(--yx-primary-light); }

/* 卡片 */
.yx-card {
  background: var(--yx-card);
  border: 1px solid var(--yx-border);
  border-radius: var(--yx-radius);
  box-shadow: var(--yx-shadow);
}
.yx-card-hover { transition: transform .18s ease, box-shadow .18s ease; }
.yx-card-hover:active { transform: scale(.985); }

/* 套餐卡片 */
.plan-card { height: 100%; display: flex; flex-direction: column; }
.plan-card .plan-title { font-size: 17px; font-weight: 700; }
.plan-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 20px;
  background: var(--yx-primary-light); color: var(--yx-primary);
}
.plan-price { color: #ef4444; font-weight: 700; font-size: 22px; line-height: 1; }
.plan-price small { font-size: 12px; font-weight: 400; color: var(--yx-muted); }
.plan-spec { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.plan-spec span {
  font-size: 12px; color: var(--yx-muted);
  background: #f1f5f9; border-radius: 6px; padding: 3px 8px;
}

/* 进度条 */
.yx-progress { height: 6px; background: #eef2f7; border-radius: 6px; overflow: hidden; }
.yx-progress > div { height: 100%; background: linear-gradient(90deg, #3b82f6, #6366f1); border-radius: 6px; }

/* 按钮 */
.btn { border-radius: 10px; font-size: 14px; }
.btn-primary { background: var(--yx-primary); border-color: var(--yx-primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--yx-primary-dark); border-color: var(--yx-primary-dark); }
.btn-lg { padding: .7rem 1.1rem; font-size: 15px; }

/* 底部固定操作栏 */
.yx-bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--yx-border);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  z-index: 1030;
}

/* 用户中心侧边菜单 */
.yx-user-nav { position: sticky; top: 76px; }
.yx-user-nav .list-group-item {
  border: 0; border-radius: 10px !important; margin-bottom: 4px;
  color: var(--yx-muted); font-size: 14px; padding: .6rem .9rem;
}
.yx-user-nav .list-group-item.active { background: var(--yx-primary); color: #fff; }

/* 主机卡片 */
.host-card .host-addr {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px; font-weight: 600; color: var(--yx-primary);
}
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.status-running .status-dot { background: #22c55e; }
.status-stopped .status-dot { background: #94a3b8; }
.status-expired .status-dot { background: #f59e0b; }
.status-abnormal .status-dot { background: #ef4444; }

/* 统计卡 */
.stat-card { padding: 16px; }
.stat-card .stat-value { font-size: 24px; font-weight: 700; }
.stat-card .stat-label { font-size: 12px; color: var(--yx-muted); }

/* 二维码 */
.qr-box { text-align: center; padding: 16px; }
.qr-box img { max-width: 220px; width: 100%; }
#qrcode { display: inline-block; padding: 10px; background: #fff; border-radius: 12px; }
#qrcode img, #qrcode canvas { display: block; }

/* 表格 */
.table { font-size: 13px; }
.table > :not(caption) > * > * { padding: .6rem .5rem; }
.yx-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* 表单 */
.form-control, .form-select { border-radius: 10px; border-color: #dbe2ea; font-size: 14px; }
.form-control:focus, .form-select:focus { border-color: var(--yx-primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.form-label { font-size: 13px; color: #334155; font-weight: 500; margin-bottom: .3rem; }

/* 页脚 */
.yx-footer { color: var(--yx-muted); font-size: 12px; text-align: center; padding: 24px 16px 30px; }
.yx-footer a { color: var(--yx-muted); }

/* 空状态 */
.yx-empty { text-align: center; padding: 50px 20px; color: var(--yx-muted); }
.yx-empty .yx-empty-icon { font-size: 40px; opacity: .35; }

/* 后台 */
.yx-admin-sidebar {
  background: #ffffff; color: #475569; min-height: 100vh; width: 210px; position: fixed; top: 0; left: 0;
  padding: 18px 12px; overflow-y: auto; border-right: 1px solid var(--yx-border);
}
.yx-admin-sidebar .brand { color: var(--yx-text); font-weight: 700; font-size: 16px; padding: 6px 10px 18px; display: flex; align-items: center; gap: 8px; }
.yx-admin-sidebar a {
  color: #475569; display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 9px; font-size: 14px; margin-bottom: 2px;
}
.yx-admin-sidebar a svg { flex: 0 0 auto; opacity: .85; }
.yx-admin-sidebar a:hover { background: #f1f5f9; color: var(--yx-primary); }
.yx-admin-sidebar a.active { background: var(--yx-primary-light); color: var(--yx-primary); font-weight: 600; }
.yx-admin-main { margin-left: 210px; padding: 20px; }
.yx-admin-topbar { background: #fff; border-bottom: 1px solid var(--yx-border); padding: 12px 20px; margin: -20px -20px 20px; display: flex; align-items: center; justify-content: space-between; }

/* 前台区域侧边栏 */
.yx-region-nav { position: sticky; top: 76px; }
.yx-region-title { font-size: 12px; color: var(--yx-muted); padding: 6px 10px 8px; }
.yx-region-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: 10px; color: #475569; font-size: 14px;
}
.yx-region-item svg { flex: 0 0 auto; opacity: .8; }
.yx-region-item:hover { background: #f1f5f9; color: var(--yx-primary); }
.yx-region-item.active { background: var(--yx-primary-light); color: var(--yx-primary); font-weight: 600; }

@media (max-width: 767.98px) {
  .yx-admin-sidebar { position: static; width: 100%; min-height: auto; display: flex; overflow-x: auto; padding: 10px; border-right: 0; border-bottom: 1px solid var(--yx-border); }
  .yx-admin-sidebar .brand { display: none; }
  .yx-admin-sidebar a { white-space: nowrap; margin: 0 4px 0 0; }
  .yx-admin-main { margin-left: 0; padding: 14px; }
  .yx-admin-topbar { margin: -14px -14px 14px; padding: 10px 14px; }
  .yx-user-nav { position: static; margin-bottom: 14px; }
  .yx-region-nav { position: static; margin-bottom: 14px; }
  .yx-region-list { display: flex; overflow-x: auto; }
  .yx-region-item { white-space: nowrap; }
}

/* Toast */
.yx-toast-wrap { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 2000; width: 90%; max-width: 340px; }
.yx-toast {
  background: #fff; color: var(--yx-text); border: 1px solid var(--yx-border);
  border-radius: 10px; padding: 10px 14px; font-size: 14px;
  margin-bottom: 8px; box-shadow: 0 8px 24px rgba(16,24,40,.12); animation: yxIn .22s ease;
}
.yx-toast.error { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.yx-toast.success { background: #f0fdf4; color: #16a34a; border-color: #bbf7d0; }
@keyframes yxIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.text-muted-sm { color: var(--yx-muted); font-size: 12px; }
