/* ============================================================
   租赁平台 · 三端共用样式（浅色精致 SaaS 风）
   契约：保留 JS 渲染所用全部 class，新增样式仅做增强
   ============================================================ */
:root {
  /* 主色 */
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --primary-soft: #eff4ff;

  /* 中性色 */
  --bg: #f4f6fa;
  --bg-soft: #f8fafc;
  --card: #ffffff;
  --text: #16202e;
  --text-sub: #5b6675;
  --text-faint: #8a94a3;
  --border: #e6ebf2;
  --border-strong: #d4dce7;

  /* 状态色 */
  --ok: #16a34a;
  --ok-soft: #dcfce7;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fef2f2;

  /* 形态 */
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .10), 0 2px 4px rgba(16, 24, 40, .06);
  --shadow-lg: 0 20px 48px rgba(16, 24, 40, .22);
  --maxw: 1180px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
p { margin: 0; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- 顶部导航 ---------- */
.topbar {
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar .container { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 18px; color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand::before {
  content: ""; width: 22px; height: 22px; border-radius: 7px;
  background: linear-gradient(135deg, var(--primary), #60a5fa);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25);
}
.brand span { color: var(--primary); }

.nav { display: flex; gap: 6px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.nav a {
  color: var(--text-sub); font-size: 14.5px; padding: 8px 13px; border-radius: 9px;
  transition: background .15s, color .15s, box-shadow .15s;
}
.nav a:hover { color: var(--primary); background: var(--primary-soft); text-decoration: none; }
.nav a.active {
  color: var(--primary); background: var(--primary-light); font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--primary);
}
.nav .hint { margin: 0 6px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: var(--radius-sm); padding: 9px 16px;
  font-size: 14.5px; font-weight: 500; cursor: pointer; background: #eef2f7; color: var(--text);
  transition: filter .15s, background .15s, border-color .15s, box-shadow .15s, transform .1s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(.97); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--primary); color: #fff;
  box-shadow: 0 1px 2px rgba(37, 99, 235, .35);
}
.btn.primary:hover { background: var(--primary-dark); filter: none; }
.btn.ghost { background: #fff; border-color: var(--border-strong); color: var(--text); }
.btn.ghost:hover { background: var(--bg-soft); filter: none; }
.btn.danger { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }
.btn.danger:hover { background: #fee2e2; filter: none; }
.btn.sm { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-head h2 { font-size: 16.5px; font-weight: 600; }
.card-body { padding: 22px; }
.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) {
  .grid.cols-4, .grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
}

/* 统计卡 */
.stat { padding: 20px; }
.stat b { display: block; font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.stat small { display: block; color: var(--text-sub); font-size: 13px; margin-top: 2px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th {
  color: var(--text-sub); font-weight: 600; font-size: 12.5px; white-space: nowrap;
  background: var(--bg-soft);
}
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--bg-soft); }
tr:last-child td { border-bottom: none; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.hint { color: var(--text-sub); font-size: 13px; }
.empty { padding: 40px 20px; text-align: center; color: var(--text-faint); }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: #eef2f7; color: var(--text-sub); white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.off { background: #f1f5f9; color: var(--text-sub); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13.5px; font-weight: 500; margin-bottom: 7px; color: var(--text-sub); }
.input, select, textarea {
  width: 100%; padding: 10px 13px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-size: 14.5px; background: #fff; color: var(--text); font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}
textarea { resize: vertical; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.acts { display: flex; gap: 8px; flex-wrap: wrap; }

/* 分段选择器（登录/注册） */
.seg { display: flex; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: 4px; gap: 4px; }
.seg-btn {
  flex: 1; padding: 10px 0; border: 0; background: transparent; border-radius: 9px;
  font-size: 14.5px; font-weight: 500; cursor: pointer; color: var(--text-sub);
  transition: background .15s, color .15s, box-shadow .15s, font-weight .15s;
}
.seg-btn.active {
  background: var(--primary); color: #fff; font-weight: 600;
  box-shadow: 0 2px 6px rgba(37, 99, 235, .35);
}
.seg-btn:hover:not(.active) { color: var(--primary); background: var(--primary-soft); }

/* 多选附加服务：复选框条目 */
#addonChecks label {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; cursor: pointer; font-size: 14px;
  transition: border-color .15s, background .15s;
}
#addonChecks label:hover { border-color: var(--border-strong); background: var(--bg-soft); }
#addonChecks input { accent-color: var(--primary); }

/* ---------- 页面区块 ---------- */
.section { padding: 48px 0; }
section[id] { scroll-margin-top: 76px; }
.section h2 { font-size: 25px; font-weight: 700; margin: 0 0 8px; letter-spacing: -.01em; }
.subtitle { color: var(--text-sub); max-width: 640px; }

/* 后台/控制台 页面标题行 */
main h2 { font-size: 20px; font-weight: 700; }

/* ---------- 官网 Hero ---------- */
.hero {
  background:
    radial-gradient(1200px 400px at 80% -10%, rgba(96, 165, 250, .18), transparent 60%),
    linear-gradient(180deg, var(--primary-soft) 0%, var(--bg) 100%);
  padding: 72px 0 56px;
}
.hero h1 { font-size: 38px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 16px; }
.hero .subtitle { font-size: 16.5px; margin: 0 auto 28px; }
.hero .row { justify-content: center; }

/* 官网规格卡片（可轻微抬升） */
.grid .card { transition: box-shadow .15s, transform .15s, border-color .15s; }
.grid .card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

/* ---------- 页脚 ---------- */
.footer { border-top: 1px solid var(--border); padding: 28px 0; color: var(--text-sub); font-size: 13px; margin-top: 40px; background: var(--bg-soft); }

/* 官网贴底布局：内容不足一屏时，页脚固定在视口底部 */
body.site { display: flex; flex-direction: column; min-height: 100vh; }
body.site .section { flex: 1 0 auto; }

/* ---------- 官网概览：大屏一屏排布，可完整显示时不产生整页滚动 ---------- */
#view-home { display: flex; flex-direction: column; }
@media (min-height: 800px) {
  #view-home .hero { padding: 34px 0 26px; }
  #view-home .hero h1 { font-size: 31px; margin: 0 0 10px; }
  #view-home .hero .subtitle { margin: 0 auto 16px; }
  #view-home > .container { margin-top: 16px !important; }
  #view-home .grid.cols-4 { margin-top: 0; }
  #view-home .stat { padding: 14px 16px; }
  #view-home .stat b { font-size: 22px; }
  #view-home .card-head { padding: 0 0 12px; }
  #homeProducts .card-body { padding: 16px; }
  .footer { padding: 18px 0; margin-top: 24px; }
}

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .45);
  backdrop-filter: blur(2px); z-index: 30;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-mask .card { box-shadow: var(--shadow-lg); animation: modal-in .18s ease-out; }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- 确认弹窗 ---------- */
.confirm-box { max-width: 420px; width: 100%; padding: 28px 26px; text-align: center; }
.confirm-icon {
  width: 44px; height: 44px; margin: 0 auto 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; color: var(--primary); background: var(--primary-light);
}
.confirm-icon.danger { color: var(--danger); background: var(--danger-soft); }
.confirm-title { font-size: 17px; font-weight: 700; margin: 0 0 8px; }
.confirm-msg { color: var(--text-sub); font-size: 14px; margin: 0 0 22px; }
.confirm-acts { justify-content: center; }
.confirm-acts .btn { min-width: 96px; }

/* ---------- 更多下拉菜单 ---------- */
.menu-wrap { position: relative; display: inline-block; }
.more-btn {
  width: 32px; height: 32px; padding: 0; border: 1px solid var(--border-strong);
  background: #fff; border-radius: 9px; cursor: pointer; color: var(--text-sub);
  font-size: 18px; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
}
.more-btn:hover { background: var(--bg-soft); }
.more-btn.active { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-light); }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 140px; z-index: 25;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md); padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 12px;
  border: 0; background: transparent; border-radius: 8px; font-size: 13.5px; cursor: pointer;
  color: var(--text); text-align: left; white-space: nowrap;
}
.menu-item:hover { background: var(--bg-soft); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-soft); }

/* 确认弹窗内后果清单 */
.confirm-msg ul { margin: 6px 0 0; padding-left: 18px; text-align: left; }
.confirm-msg li { margin: 5px 0; }
.confirm-msg .notice { display: block; margin-bottom: 8px; font-weight: 600; color: var(--warn); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 11px 20px; border-radius: 11px;
  font-size: 14px; z-index: 50; box-shadow: var(--shadow-md);
}
.hidden { display: none !important; }

/* ---------- 滚动条美化 ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }
*::-webkit-scrollbar-corner { background: transparent; }

/* ---------- 控制台：列表高度自适应视口 ---------- */
html, body.console-page { height: 100%; }
body.console-page { display: flex; flex-direction: column; overflow: hidden; }
body.console-page .topbar { flex: 0 0 auto; }
.console-main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.console-main section { flex: 0 0 auto; }
#viewInstances, #viewOrders, #viewNotifications { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
#viewInstances .card, #viewOrders .card, #viewNotifications .card { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
#viewInstances .table-wrap, #viewOrders .table-wrap { flex: 1 1 auto; min-height: 0; overflow: auto; }
/* 表头随列表滚动固定在顶部 */
.table-wrap thead th { position: sticky; top: 0; z-index: 1; background: var(--bg-soft); }

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .topbar .container { height: auto; padding: 12px 20px; gap: 12px; flex-wrap: wrap; }
  .nav { margin-left: 0; width: 100%; gap: 4px; }
  .nav a { padding: 7px 10px; font-size: 14px; }
  .hero { padding: 48px 0 36px; }
  .hero h1 { font-size: 28px; }
  .section { padding: 32px 0; }
}

/* ---------- 通知导航入口 ---------- */
.nav a.nav-link-icon {
  display: inline-flex; align-items: center; gap: 6px; position: relative;
}
.nav a.nav-link-icon svg { display: block; }
.bell-badge {
  position: absolute; top: -4px; right: -6px; min-width: 17px; height: 17px; padding: 0 5px;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; border: 2px solid #fff;
}

/* ---------- 通知列表 ---------- */
.notify-list { display: flex; flex-direction: column; gap: 10px; }
.notify-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.notify-item {
  display: flex; gap: 12px; padding: 13px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: #fff;
}
.notify-item.unread { background: var(--primary-soft); border-color: var(--primary-light); }
.notify-item .dot {
  flex: 0 0 auto; width: 9px; height: 9px; margin-top: 7px; border-radius: 50%; background: var(--border-strong);
}
.notify-item.unread .dot { background: var(--primary); }
.notify-item .n-body { flex: 1 1 auto; min-width: 0; }
.notify-item .n-title { font-weight: 600; font-size: 14px; }
.notify-item .n-content { color: var(--text-sub); font-size: 13px; margin-top: 2px; word-break: break-all; }
.notify-item .n-time { color: var(--text-faint); font-size: 12px; margin-top: 4px; }
.notify-type { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #eef2f7; color: var(--text-sub); margin-left: 6px; }

/* ---------- 账号信息卡 ---------- */
.account-wrap { position: relative; display: inline-flex; align-items: center; }
/* 透明桥接带：填补触发按钮与信息卡之间的间隙，鼠标慢移经过时不中断 hover */
.account-wrap::after {
  content: ""; position: absolute; right: 22px; top: 100%; height: 10px; width: 160px;
}
.account-trigger {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px;
  border: 1px solid var(--border-strong); background: #fff; border-radius: 999px; cursor: pointer;
  font-size: 14px; color: var(--text); transition: background .15s, border-color .15s;
}
.account-trigger:hover { background: var(--bg-soft); border-color: var(--border-strong); }
.account-avatar {
  width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), #60a5fa);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.account-card {
  position: absolute; right: 0; top: calc(100% + 10px); width: 280px; z-index: 28;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 16px; display: none;
}
.account-wrap:hover .account-card, .account-card.open { display: block; }
.account-card::before {
  content: ""; position: absolute; right: 22px; top: -7px; width: 14px; height: 14px;
  background: #fff; border-left: 1px solid var(--border); border-top: 1px solid var(--border);
  transform: rotate(45deg);
}
.account-card .ac-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.account-card .ac-head .account-avatar { width: 42px; height: 42px; font-size: 17px; }
.account-card .ac-name { font-weight: 700; font-size: 15.5px; }
.account-card .ac-sub { color: var(--text-sub); font-size: 12.5px; }
.account-card .ac-stats { display: flex; gap: 10px; margin-bottom: 12px; }
.account-card .ac-stat {
  flex: 1; text-align: center; padding: 9px 6px; border-radius: var(--radius-sm);
  background: var(--bg-soft);
}
.account-card .ac-stat b { display: block; font-size: 17px; }
.account-card .ac-stat small { color: var(--text-sub); font-size: 11.5px; }
.account-card .ac-acts { display: flex; flex-direction: column; gap: 8px; }

/* ---------- 实例详情区块 ---------- */
.detail-body { overflow-y: auto; }
.detail-section { margin-bottom: 20px; }
.detail-section:last-child { margin-bottom: 0; }
.detail-section-title {
  font-size: 13px; font-weight: 600; color: var(--text-sub);
  margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.detail-section-title .acts { margin: 0; }
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.kv-item .k { font-size: 12px; color: var(--text-faint); }
.kv-item .v { font-size: 14px; font-weight: 500; margin-top: 1px; word-break: break-all; }
.kv-full { grid-column: 1 / -1; }

/* 用量条 */
.usage-row { display: flex; align-items: center; gap: 12px; margin: 9px 0; }
.usage-row .u-name { width: 56px; font-size: 13px; color: var(--text-sub); }
.usage-row .u-bar { flex: 1; height: 8px; border-radius: 999px; background: #eef2f7; overflow: hidden; }
.usage-row .u-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), #60a5fa); }
.usage-row .u-val { width: 46px; text-align: right; font-size: 12.5px; color: var(--text-sub); }

/* 附加服务 chip */
.addon-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff;
  font-size: 13.5px; margin: 0 8px 8px 0;
}
.addon-chip .chip-x { border: 0; background: transparent; color: var(--text-faint); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; }
.addon-chip .chip-x:hover { color: var(--danger); }

/* 开关 */
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { display: none; }
.switch .track { width: 38px; height: 22px; border-radius: 999px; background: #cbd5e1; transition: background .15s; position: relative; flex: 0 0 auto; }
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch .sw-label { font-size: 13.5px; color: var(--text-sub); }

.detail-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.access-mono { font-family: ui-monospace, Menlo, Consolas, monospace; }

@media (max-width: 600px) {
  .kv-grid { grid-template-columns: 1fr; }
}

