/* ==========================================================================
   云主机客户中心 · 商业化浅色主题
   ========================================================================== */

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8faff;
  --text: #111827;
  --text-soft: #374151;
  --muted: #6b7280;
  --line: #e6eaf2;
  --line-strong: #d8deea;
  --brand: #3b5bdb;
  --brand-dark: #2f49b0;
  --brand-soft: #eef2ff;
  --brand-soft-2: #e0e7ff;
  --success: #0f9d58;
  --success-soft: #e7f7ee;
  --warning: #d97706;
  --warning-soft: #fff7e6;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 10px 30px rgba(16, 24, 40, .05);
  --shadow-lg: 0 20px 50px rgba(16, 24, 40, .16);
  --sidebar-w: 248px;
  --topbar-h: 76px;
  --font: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
code, .mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.ta-right { text-align: right; }
.mt-12 { margin-top: 12px; }
.icon { flex: 0 0 auto; display: inline-block; vertical-align: -3px; }

/* -------------------------------- 布局 -------------------------------- */

.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 22px 18px;
  color: var(--text);
}

.brand:hover { color: var(--text); }

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, #4f6ef7 0%, #2f49b0 100%);
  box-shadow: 0 6px 16px rgba(59, 91, 219, .28);
  flex: 0 0 auto;
}

.brand-mark.large { width: 48px; height: 48px; border-radius: 14px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { font-size: 17px; letter-spacing: .3px; }
.brand-text small { color: var(--muted); font-size: 11px; letter-spacing: 1px; }

.nav { flex: 1; padding: 8px 14px; overflow-y: auto; }
.nav-label {
  display: block;
  padding: 16px 10px 8px;
  font-size: 11px;
  letter-spacing: 1.4px;
  color: #9aa3b2;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  margin-bottom: 4px;
  border-radius: 11px;
  color: var(--text-soft);
  font-weight: 500;
  transition: background .15s ease, color .15s ease;
}

.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 600;
}
.nav-item.active .icon { color: var(--brand); }

.sidebar-foot { padding: 14px; border-top: 1px solid var(--line); }

.user-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: var(--surface-2);
}
.user-mini-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.user-mini-text strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-mini-text small { color: var(--muted); font-size: 11px; }

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #dfe6ff, #c7d2fe);
  color: var(--brand-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex: 0 0 auto;
}
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.avatar.xl { width: 68px; height: 68px; font-size: 26px; }

.main {
  min-height: 100vh;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  padding: 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(244, 246, 251, .86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(230, 234, 242, .8);
}

.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.page-heading h1 { font-size: 21px; font-weight: 700; letter-spacing: .2px; }
.page-heading p { color: var(--muted); font-size: 12px; margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--success-soft);
  color: #0b7a44;
  font-size: 12px;
  font-weight: 600;
}
.topbar-date { color: var(--muted); font-size: 12px; }

.menu-btn { display: none !important; }

.content {
  flex: 1;
  width: 100%;
  max-width: 1480px;
  padding: 26px 30px 18px;
  margin: 0 auto;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, .45);
  z-index: 35;
}

.footer {
  padding: 30px 0 10px;
  color: #9aa3b2;
  font-size: 12px;
  text-align: center;
}

/* -------------------------------- 基础组件 -------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
}
.card-head h3 { font-size: 15px; font-weight: 700; }
.card-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.card-foot-more { margin-top: 16px; }

.link { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 500; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 15px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text-soft);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.btn:hover { background: var(--surface-2); border-color: #c9d2e3; color: var(--text); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 91, 219, .22);
}
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.btn-danger-ghost { color: var(--danger); border-color: #f3c9c9; background: #fff; }
.btn-danger-ghost:hover { background: var(--danger-soft); border-color: #efb2b2; color: #b91c1c; }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-sm { height: 32px; padding: 0 11px; border-radius: 8px; font-size: 12.5px; }
.btn-lg { height: 44px; border-radius: 11px; font-size: 15px; }
.btn-block { width: 100%; }

.icon-btn {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--brand-soft); color: var(--brand); }

.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; flex: 0 0 auto; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  background: #f1f3f8;
  color: var(--text-soft);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-soft); color: #0b7a44; }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--brand-soft); color: var(--brand-dark); }
.badge-brand { background: var(--brand-soft); color: var(--brand-dark); }
.badge-muted { background: #f1f3f8; color: var(--muted); }

.alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 14px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 13px;
}
.alert .icon { margin-top: 3px; }
.alert span { flex: 1; }
.alert-success { background: var(--success-soft); border-color: #c3ebd4; color: #0b6b3e; }
.alert-danger { background: var(--danger-soft); border-color: #f7cccc; color: #a81b1b; }
.alert-warning { background: var(--warning-soft); border-color: #f3dfb8; color: #955c04; }
.alert-info { background: var(--brand-soft); border-color: #d6def9; color: var(--brand-dark); }
.alert.compact { padding: 8px 11px; font-size: 12px; margin-top: 12px; }
.alert-close { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 2px; opacity: .7; }
.alert-close:hover { opacity: 1; }
.alert-stack, .flash-stack { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--text-soft); }
.field-hint { font-size: 11.5px; color: var(--muted); }
.field-hint.danger { color: var(--danger); }

.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  padding: 9px 12px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input { height: 40px; }
/* 下拉框去掉上下内边距，避免内容区被压扁导致中文上下被裁切 */
.select { height: 40px; padding: 0 30px 0 12px; line-height: normal; }
.textarea { resize: vertical; min-height: 96px; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(59, 91, 219, .12);
}
.input::placeholder, .textarea::placeholder { color: #a3aab8; }
.select-sm, .input-sm { height: 38px; font-size: 13px; }

.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .icon { position: absolute; left: 12px; color: #9aa3b2; }
.input-wrap .input { padding-left: 38px; }
.input-wrap .input-action { position: absolute; right: 6px; }
.input-wrap .input[type="password"] { padding-right: 40px; }

.checkbox, .radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-soft);
  cursor: pointer;
}
.checkbox input, .radio input { width: 16px; height: 16px; accent-color: var(--brand); }
.checkbox-inline { height: 40px; }
.radio-group { display: flex; flex-wrap: wrap; gap: 18px; margin: 4px 0 14px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid-4 { grid-template-columns: repeat(4, 1fr); }
.form-actions { display: flex; align-items: center; gap: 10px; grid-column: 1 / -1; }
.inline-form { display: inline-flex; margin: 0; }

.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left;
  font-size: 11.5px;
  letter-spacing: .4px;
  color: var(--muted);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  white-space: nowrap;
}
.table td { padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbff; }
.table-loading { text-align: center; color: var(--muted); padding: 28px 12px !important; }
.row-actions { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.cell-user { display: flex; align-items: center; gap: 9px; }
.cell-user strong { display: block; font-size: 13px; }
.cell-user small { display: block; color: var(--muted); font-size: 11.5px; }

/* -------------------------------- 仪表盘 -------------------------------- */

.welcome-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.welcome-row h2 { font-size: 19px; font-weight: 700; }
.welcome-row p { font-size: 12.5px; margin-top: 3px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.stat-icon.brand { background: var(--brand-soft); color: var(--brand); }
.stat-icon.success { background: var(--success-soft); color: var(--success); }
.stat-icon.warning { background: var(--warning-soft); color: var(--warning); }
.stat-icon.danger { background: var(--danger-soft); color: var(--danger); }
.stat-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { font-size: 23px; font-weight: 700; letter-spacing: -.4px; line-height: 1.25; }
.stat-value small { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.stat-foot { color: var(--muted); font-size: 11.5px; }
.stat-grid-compact .stat-value { font-size: 20px; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.side-column { display: flex; flex-direction: column; gap: 18px; }
/* 实例页主列：工具栏 + 卡片列表纵向排列，间距与右侧卡片一致 */
.instances-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.instances-main .toolbar { margin-bottom: 0; }

.instance-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.instance-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 17px;
  background: var(--surface);
  transition: box-shadow .18s ease, border-color .18s ease, transform .18s ease;
}
.instance-card:hover { border-color: #d3daea; box-shadow: 0 12px 26px rgba(16, 24, 40, .07); }
.instance-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.instance-title { display: flex; gap: 10px; min-width: 0; }
.instance-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--brand-soft);
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.instance-icon.large { width: 52px; height: 52px; border-radius: 14px; }
.instance-name { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.instance-meta { color: var(--muted); font-size: 11.5px; margin-top: 1px; }
.spec-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 13px 0 14px; }
.chip {
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-soft);
  font-size: 11.5px;
}
.metric-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.metric-label { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-bottom: 5px; }
.metric-label b { color: var(--text-soft); font-weight: 600; }
.meter { height: 7px; border-radius: 999px; background: #eef1f7; overflow: hidden; }
.meter-fill { display: block; height: 100%; width: var(--v, 0%); border-radius: inherit; background: var(--brand); transition: width .45s ease; }
.meter-fill.warning { background: #f59e0b; }
.meter-fill.danger { background: #ef4444; }
.meter-slim { height: 4px; margin-top: 5px; }

.instance-net { margin: 13px 0; padding: 9px 11px; border-radius: 9px; background: var(--surface-2); display: flex; flex-direction: column; gap: 5px; }
.net-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.net-label { flex: 0 0 34px; font-size: 10.5px; color: var(--muted); letter-spacing: .4px; }
.net-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; color: var(--text-soft); }
.instance-net .icon-btn { width: 24px; height: 24px; }

.instance-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.foot-info { flex: 1; min-width: 0; }
.traffic-text { font-size: 11.5px; color: var(--muted); }
.expire-text { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.instance-actions { display: flex; gap: 7px; margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--line); }
.instance-actions .btn { flex: 1; padding: 0 8px; }
.instance-actions .btn-primary { flex: 1.15; }

.empty-state { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty-state.small { padding: 24px 16px; }
.empty-icon {
  width: 58px; height: 58px; border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: #9aa3b2; margin-bottom: 12px;
}
.empty-icon.danger { background: var(--danger-soft); color: var(--danger); }
.empty-state h4 { color: var(--text); font-size: 15px; margin-bottom: 4px; }
.empty-state p { font-size: 12.5px; }
.empty-state .btn { margin-top: 14px; }

.notice-list { display: flex; flex-direction: column; gap: 12px; max-height: 440px; overflow-y: auto; }
.notice-item { padding: 12px 13px; border-radius: 11px; background: var(--surface-2); border-left: 3px solid var(--brand); }
.notice-item.notice-warning { border-left-color: var(--warning); background: #fffbf2; }
.notice-item.notice-danger { border-left-color: var(--danger); background: #fff7f7; }
.notice-item.notice-success { border-left-color: var(--success); background: #f5fdf9; }
.notice-title { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.notice-content { color: var(--muted); font-size: 12.5px; margin-top: 5px; white-space: pre-wrap; word-break: break-word; }
.notice-time { display: block; color: #9aa3b2; font-size: 11px; margin-top: 7px; }

.guide-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.guide-list li { display: flex; gap: 9px; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.guide-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--brand); margin-top: 8px; flex: 0 0 auto; }

/* -------------------------------- 实例列表 -------------------------------- */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding: 14px 16px;
  margin-bottom: 18px;
}
/* 左侧筛选组：一行排列，空间不足时整组换行，绝不让左右两组合并重叠 */
.toolbar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: 1 1 auto; min-width: 0; }
.toolbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: 0 0 auto; }
.search-box { position: relative; display: flex; align-items: center; }
.toolbar-left .search-box { flex: 0 1 auto; min-width: 150px; }
.search-box .icon { position: absolute; left: 11px; color: #9aa3b2; }
.input-search { width: 240px; max-width: 100%; height: 38px; padding-left: 34px; font-size: 13px; }
/* 工具栏下拉框按内容自适应宽度，保持横向一行排列（覆盖 .select 的 width:100%） */
.toolbar .select { width: auto; min-width: 118px; height: 38px; padding: 0 30px 0 12px; flex: 0 0 auto; }

/* -------------------------------- 实例详情 -------------------------------- */

.back-link { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12.5px; margin-bottom: 12px; }
.back-link:hover { color: var(--brand); }

.detail-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.detail-hero-main { display: flex; gap: 14px; min-width: 0; }
.detail-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-title-row h2 { font-size: 20px; font-weight: 700; }
.detail-hero-main p { font-size: 12.5px; margin-top: 3px; }
.detail-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.tabs { display: flex; gap: 6px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.tab {
  position: relative;
  padding: 10px 16px 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand); }
.tab.active::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--brand);
}

.detail-layout { display: grid; grid-template-columns: minmax(0, 2.25fr) minmax(300px, .9fr); gap: 18px; }
.chart-panel { padding-bottom: 12px; }
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.chart-box { border: 1px solid var(--line); border-radius: 12px; padding: 12px 13px 8px; background: #fff; }
.chart-title { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; font-weight: 600; color: var(--text-soft); margin-bottom: 4px; }
.chart-title em { font-style: normal; font-size: 10.5px; color: var(--muted); background: var(--surface-2); padding: 1px 6px; border-radius: 5px; }
.chart-box canvas { display: block; width: 100%; height: 200px; }

.range-tabs { display: inline-flex; gap: 3px; padding: 3px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); }
.range-tab {
  border: 0; background: transparent; color: var(--muted);
  padding: 5px 10px; border-radius: 7px; font-size: 12px; cursor: pointer;
}
.range-tab:hover { color: var(--text); }
.range-tab.active { background: #fff; color: var(--brand); font-weight: 600; box-shadow: 0 1px 3px rgba(16, 24, 40, .08); }

.info-list { margin: 0; display: flex; flex-direction: column; gap: 0; }
.info-list > div {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 12.5px;
}
.info-list > div:last-child { border-bottom: 0; padding-bottom: 0; }
.info-list dt { color: var(--muted); flex: 0 0 auto; }
.info-list dd { margin: 0; text-align: right; color: var(--text-soft); min-width: 0; word-break: break-all; }
.copy-line { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.copy-line code { font-size: 11.5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.copy-line .icon-btn { width: 24px; height: 24px; }

.traffic-block { padding: 4px 0 2px; }
.password-result { margin-top: 14px; padding: 12px; border-radius: 10px; background: var(--success-soft); border: 1px solid #c3ebd4; }
.password-result .copy-line code { background: #fff; font-size: 13px; }

/* -------------------------------- 账户 -------------------------------- */

.account-grid { display: grid; grid-template-columns: minmax(300px, .9fr) minmax(0, 1.4fr); gap: 18px; margin-bottom: 18px; }
.profile-head { display: flex; align-items: center; gap: 16px; padding-bottom: 18px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.profile-head h2 { font-size: 19px; }
.profile-head p { font-size: 12.5px; margin-top: 2px; }

/* -------------------------------- 管理后台 -------------------------------- */

.admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.admin-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.admin-tab:hover { border-color: #cfd8e8; }
.admin-tab.active { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(59, 91, 219, .2); }
.admin-section { display: flex; flex-direction: column; gap: 18px; }

/* -------------------------------- 弹窗与提示 -------------------------------- */

.dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: visible;
}
.dialog::backdrop { background: rgba(17, 24, 39, .5); backdrop-filter: blur(2px); }
.dialog[open] { animation: dialog-in .18s ease-out; }
@keyframes dialog-in {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.dialog-form { display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
.dialog-body { overflow-y: auto; }
.dialog-head {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 14px 24px;
  border-bottom: 1px solid var(--line);
  cursor: default;
}
.dialog-grip {
  position: absolute;
  top: 0; left: 0;
  width: 20px; height: 20px;
  cursor: move;
  background-image: radial-gradient(#c3cad8 1px, transparent 1px);
  background-size: 5px 5px;
  background-position: 6px 6px;
  border-top-left-radius: var(--radius);
  touch-action: none;
}
.dialog-head h3 { font-size: 16px; font-weight: 700; }
.dialog-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.dialog-close { position: absolute; top: 12px; right: 12px; }
.dialog-body { padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 22px 18px; border-top: 1px solid var(--line); }
.dialog-result { padding: 11px 13px; border-radius: 10px; background: var(--success-soft); color: #0b6b3e; font-size: 13px; }

.toast-wrap {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
}
.toast {
  min-width: 240px;
  max-width: 380px;
  padding: 11px 14px;
  border-radius: 11px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  color: var(--text-soft);
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  animation: toast-in .2s ease-out;
  pointer-events: auto;
}
.toast.success { border-color: #bfe8d2; background: #f7fdf9; color: #0b6b3e; }
.toast.error { border-color: #f3c9c9; background: #fff8f8; color: #a81b1b; }
.toast.info { border-color: #d6def9; background: #f8faff; color: var(--brand-dark); }
.toast .toast-close { margin-left: auto; border: 0; background: transparent; color: inherit; cursor: pointer; opacity: .6; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.btn-spinner {
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.confirm-message { color: var(--text-soft); font-size: 13.5px; line-height: 1.7; white-space: pre-line; }
.dialog-result.danger { background: var(--danger-soft); color: #a81b1b; }

.chart-box { position: relative; }
.chart-tooltip {
  position: absolute;
  z-index: 5;
  min-width: 132px;
  padding: 9px 10px;
  border-radius: 9px;
  background: rgba(17, 24, 39, .92);
  color: #fff;
  font-size: 11.5px;
  box-shadow: 0 8px 22px rgba(16, 24, 40, .2);
  pointer-events: none;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity .12s ease, transform .12s ease;
}
.chart-tooltip.show { opacity: 1; transform: translateY(0); }
.chart-tip-time { color: rgba(255,255,255,.62); margin-bottom: 5px; font-size: 10.5px; }
.chart-tip-line { display: flex; align-items: center; gap: 6px; line-height: 1.7; }
.chart-tip-line i { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; }
.chart-tip-line span { flex: 1; color: rgba(255,255,255,.75); }
.chart-tip-line b { font-weight: 600; }

/* -------------------------------- 登录页 -------------------------------- */

.login-body { background: var(--surface); }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1.12fr 1fr; }

.login-visual {
  position: relative;
  overflow: hidden;
  padding: 42px 52px;
  display: flex;
  flex-direction: column;
  color: #fff;
  background:
    radial-gradient(900px 500px at 10% 5%, rgba(120, 145, 255, .45), transparent 60%),
    radial-gradient(700px 500px at 95% 85%, rgba(56, 189, 248, .22), transparent 60%),
    linear-gradient(145deg, #1e2a78 0%, #3146ad 48%, #3b5bdb 100%);
}
.login-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(90% 80% at 50% 40%, #000 30%, transparent 100%);
  pointer-events: none;
}
.login-visual-top { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.login-visual .brand-mark { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); box-shadow: none; }
.login-brand { font-size: 17px; font-weight: 600; letter-spacing: .4px; }
.login-visual-copy { position: relative; z-index: 1; margin: auto 0; max-width: 520px; padding: 40px 0; }
.login-visual-copy h1 { font-size: 40px; line-height: 1.35; letter-spacing: 1px; font-weight: 700; }
.login-visual-copy > p { margin-top: 14px; color: rgba(255,255,255,.78); font-size: 15px; }
.login-points { list-style: none; margin: 34px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.login-points li { display: flex; align-items: center; gap: 11px; font-size: 14px; color: rgba(255,255,255,.9); }
.login-points li span {
  width: 32px; height: 32px; border-radius: 9px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  display: inline-flex; align-items: center; justify-content: center;
}
.login-visual-foot { position: relative; z-index: 1; font-size: 12px; color: rgba(255,255,255,.55); }

.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px 28px; background: var(--surface); }
.login-card { width: 100%; max-width: 390px; }
.login-mobile-brand { display: none; align-items: center; gap: 10px; margin-bottom: 26px; font-size: 17px; }
.login-card h2 { font-size: 26px; font-weight: 700; letter-spacing: .3px; }
.login-sub { color: var(--muted); font-size: 13px; margin: 7px 0 24px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-form .btn { margin-top: 4px; }
.login-auto-tip {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 20px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--brand-soft);
  border: 1px solid #d6def9;
  color: var(--brand-dark);
  font-size: 12px;
  line-height: 1.65;
}
.login-auto-tip .icon { margin-top: 2px; }
.login-auto-tip b { font-weight: 700; }
.login-tip { display: flex; align-items: flex-start; gap: 7px; color: var(--muted); font-size: 12px; margin-top: 18px; line-height: 1.6; }
.login-tip .icon { margin-top: 2px; }

/* -------------------------------- 错误页 -------------------------------- */

.error-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(700px 420px at 50% 0%, #e6ecff, transparent 70%),
    var(--bg);
}
.error-card {
  width: min(460px, 100%);
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 40px 32px;
  box-shadow: var(--shadow);
}
.error-card .brand-mark { margin-bottom: 18px; }
.error-code { font-size: 52px; font-weight: 800; color: var(--brand); letter-spacing: -2px; line-height: 1.1; }
.error-card h1 { font-size: 17px; font-weight: 600; margin: 6px 0 8px; }
.error-card p { font-size: 13px; }
.error-actions { margin-top: 22px; display: flex; justify-content: center; }

/* -------------------------------- 响应式 -------------------------------- */

@media (max-width: 1200px) {
  .dashboard-grid { grid-template-columns: minmax(0, 1fr) 280px; }
  .form-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .detail-layout { grid-template-columns: 1fr; }
  .account-grid { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 20px 0 40px rgba(16, 24, 40, .12);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex !important; }
  .topbar { padding: 0 18px; }
  .content { padding: 20px 18px 12px; }
  .topbar-date { display: none; }
  .login-shell { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-panel { min-height: 100vh; }
  .login-mobile-brand { display: flex; }
}

@media (max-width: 720px) {
  .page-heading h1 { font-size: 18px; }
  .page-heading p { display: none; }
  .topbar { height: 64px; }
  .topbar-status { padding: 5px 9px; }
  .welcome-row { flex-direction: column; align-items: flex-start; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card { padding: 14px; gap: 10px; }
  .stat-icon { width: 36px; height: 36px; }
  .stat-value { font-size: 19px; }
  .card { padding: 17px; }
  .instance-grid { grid-template-columns: 1fr; }
  .detail-hero { flex-direction: column; }
  .detail-actions { width: 100%; justify-content: flex-start; }
  .chart-grid { grid-template-columns: 1fr; }
  .chart-box canvas { height: 180px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-left { flex-wrap: wrap; }
  .toolbar-left, .toolbar-right { width: 100%; }
  .input-search { width: 100%; }
  .toolbar-left .search-box { flex: 1; }
  .toolbar .select { flex: 1 1 auto; min-width: 0; }
  .form-grid, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
  .table th, .table td { padding: 10px 9px; }
  .dialog { width: calc(100vw - 20px); }
  .login-visual-copy h1 { font-size: 30px; }
  .login-panel { padding: 28px 20px; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .stat-grid-compact { grid-template-columns: 1fr 1fr; }
  .instance-actions { flex-wrap: wrap; }
  .instance-actions .btn { flex: 1 1 40%; }
  .instance-actions .btn-primary { flex: 1 1 100%; }
  .topbar-status span { display: none; }
  .row-actions { justify-content: flex-start; }
  .table th, .table td { white-space: nowrap; }
}
