/* ============================================================
   云资源管理工作台 · 样式表
   浅色现代风 / 零外部依赖
   ============================================================ */

:root {
  --bg:            #f4f6fa;
  --surface:       #ffffff;
  --surface-2:     #fafbfd;
  --border:        #e5e8f0;
  --border-strong: #d3d8e4;
  --text:          #1e2330;
  --text-2:        #545c6b;
  --muted:         #8a92a3;
  --primary:       #4f7cff;
  --primary-dark:  #3a63e0;
  --primary-weak:  #eef3ff;

  --green:  #12a05f;   --green-bg:  #e6f7ef;
  --red:    #e03e3e;   --red-bg:    #fdecec;
  --orange: #e3801a;   --orange-bg: #fdf2e3;
  --blue:   #3b74e8;   --blue-bg:   #eaf1fe;
  --purple: #7b53d4;   --purple-bg: #f1ecfd;
  --cyan:   #0d9aa8;   --cyan-bg:   #e3f6f8;
  --gray:   #6b7280;   --gray-bg:   #f0f1f5;

  --radius:    12px;
  --radius-sm: 8px;
  --shadow-1: 0 1px 2px rgba(23, 32, 56, .05), 0 1px 3px rgba(23, 32, 56, .04);
  --shadow-2: 0 6px 24px rgba(23, 32, 56, .09);
  --shadow-3: 0 20px 60px rgba(23, 32, 56, .18);

  --sidebar-w: 226px;
  --topbar-h:  62px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

/* [hidden] 兜底：JS 大量用 el.hidden = true/false 切换显隐（登录层 / 启动屏 /
   主壳体 / 表单错误等）。HTML hidden 属性的 UA 样式 [hidden]{display:none}
   会被本表中任何带类名/ID 的 display 规则（如 .login-view{display:flex}）
   反超——作者样式永远优先于 UA 样式。不补这条，登录成功后登录框永远关不掉。 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cfd5e2; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #b6bfd1; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 启动占位 ---------------- */
.splash {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; color: var(--muted); background: var(--bg);
}
.splash-spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--border-strong); border-top-color: var(--primary);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 登录 ---------------- */
.login-view {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 460px at 12% -10%, #e3ecff 0%, transparent 62%),
    radial-gradient(760px 420px at 92% 108%, #e8f7f1 0%, transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 388px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 34px 32px 26px;
  box-shadow: var(--shadow-2);
}
.login-brand { text-align: center; margin-bottom: 26px; }
.login-brand h1 { margin: 14px 0 4px; font-size: 19px; font-weight: 650; letter-spacing: .2px; }
.login-brand p { margin: 0; color: var(--muted); font-size: 13px; }
.brand-mark {
  display: inline-block; width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(140deg, #5b86ff, #3f6bf0);
  position: relative; flex: none;
  box-shadow: 0 6px 16px rgba(79, 124, 255, .32);
}
.brand-mark::before {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 17px; height: 17px; transform: translate(-50%, -50%);
  border: 2.2px solid #fff; border-radius: 4px;
  border-bottom-width: 2.2px;
  clip-path: polygon(0 0, 100% 0, 100% 34%, 0 34%);
}
.brand-mark::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 8px; height: 8px; transform: translate(-50%, -30%);
  background: #fff; border-radius: 50%;
}
.login-error {
  background: var(--red-bg); color: var(--red);
  border: 1px solid #f6c9c9; border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 13px; margin-bottom: 14px;
}
.login-foot { text-align: center; color: var(--muted); font-size: 12px; margin: 18px 0 0; }

/* ---------------- 表单控件 ---------------- */
.field { display: block; margin-bottom: 16px; }
.field-label { display: block; font-size: 13px; font-weight: 550; color: var(--text-2); margin-bottom: 6px; }
.field-label .req { color: var(--red); margin-left: 3px; }
.field-tip { font-size: 12px; color: var(--muted); margin-top: 5px; }
.field-error { font-size: 12px; color: var(--red); margin-top: 5px; }

.input, .select, .textarea {
  width: 100%; padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:hover, .select:hover, .textarea:hover { border-color: #bfc7d8; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 124, 255, .14);
}
.input[readonly], .input.is-readonly { background: var(--surface-2); color: var(--text-2); cursor: default; }
.textarea { min-height: 74px; resize: vertical; }
.input.is-error, .select.is-error, .textarea.is-error { border-color: var(--red); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4.5L6 8.5l4-4' stroke='%238a92a3' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 40px; height: 23px; border-radius: 999px; background: #cdd3e0;
  transition: background .18s; position: relative; flex: none;
}
.switch .track::after {
  content: ""; position: absolute; top: 2.5px; left: 2.5px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .18s;
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(17px); }
.switch .switch-text { font-size: 13px; color: var(--text-2); }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-size: 13.5px; font-weight: 520;
  cursor: pointer; white-space: nowrap;
  transition: background .14s, border-color .14s, box-shadow .14s, color .14s;
}
.btn:hover { background: var(--surface-2); border-color: #bfc7d8; }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(79,124,255,.28); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #c93535; border-color: #c93535; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--gray-bg); border-color: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; padding: 10px; font-size: 14.5px; margin-top: 4px; }
.btn svg { flex: none; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid transparent; background: transparent; color: var(--text-2);
  cursor: pointer; transition: background .14s, color .14s;
}
.icon-btn:hover { background: var(--gray-bg); color: var(--text); }
.icon-btn.is-danger:hover { background: var(--red-bg); color: var(--red); }

/* ---------------- 布局 ---------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex: none;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  z-index: 40;
}
.sidebar-head {
  height: var(--topbar-h); flex: none;
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px; border-bottom: 1px solid var(--border);
}
.sidebar-head .brand-mark { width: 30px; height: 30px; border-radius: 9px; }
.sidebar-head .brand-mark::before { width: 13px; height: 13px; border-width: 2px; }
.sidebar-head .brand-mark::after { width: 6px; height: 6px; }
.sidebar-title { font-weight: 640; font-size: 14.5px; letter-spacing: .2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav { flex: 1; overflow-y: auto; padding: 12px 10px 20px; }
.nav-group { margin-bottom: 4px; }
.nav-group-title {
  font-size: 11px; font-weight: 600; color: var(--muted);
  letter-spacing: .09em; text-transform: uppercase;
  padding: 12px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 9px;
  color: var(--text-2); font-size: 13.5px; font-weight: 500;
  cursor: pointer; margin-bottom: 1px; position: relative;
  transition: background .13s, color .13s;
}
.nav-item:hover { background: var(--gray-bg); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--primary-weak); color: var(--primary-dark); font-weight: 600; }
.nav-item svg { flex: none; opacity: .82; }
.nav-item.active svg { opacity: 1; }
.nav-item .nav-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .nav-count {
  font-size: 11.5px; font-weight: 600; color: var(--muted);
  background: var(--gray-bg); border-radius: 20px; padding: 1px 7px;
  min-width: 22px; text-align: center;
}
.nav-item.active .nav-count { background: #dde7ff; color: var(--primary-dark); }
.nav-item .nav-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--orange); flex: none;
}

.sidebar-foot { flex: none; padding: 10px; border-top: 1px solid var(--border); }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 10px; cursor: pointer;
  transition: background .13s;
}
.user-chip:hover { background: var(--gray-bg); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: linear-gradient(140deg, #6d93ff, #4f7cff);
  color: #fff; font-weight: 620; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.user-chip .u-name { font-size: 13.5px; font-weight: 570; line-height: 1.25; }
.user-chip .u-role { font-size: 11.5px; color: var(--muted); line-height: 1.25; }
.user-chip .u-info { min-width: 0; overflow: hidden; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h); flex: none;
  display: flex; align-items: center; gap: 12px;
  padding: 0 22px; background: rgba(255,255,255,.86);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.crumb { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 620; min-width: 0; }
.crumb .crumb-sub { font-size: 13px; font-weight: 400; color: var(--muted); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.content { flex: 1; padding: 22px; max-width: 1680px; width: 100%; }

.sidebar-mask { display: none; }
.only-mobile { display: none !important; }

/* ---------------- 卡片 / 栅格 ---------------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-1);
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.card-title { font-size: 14.5px; font-weight: 620; }
.card-sub { font-size: 12.5px; color: var(--muted); }
.card-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }

/* 仪表盘卡片：同排等高，内容垂直重心协调 */
.dash-card { display: flex; flex-direction: column; }
.dash-card .card-body { flex: 1; display: flex; flex-direction: column; justify-content: flex-start; }
.dash-card.dash-center .card-body { justify-content: center; }
.dash-card .card-body .empty { margin: auto; padding: 40px 20px; }
.dash-card .card-body > * { width: 100%; }

/* ---------------- 统计卡 ---------------- */
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow-1); position: relative; overflow: hidden;
}
.stat-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.stat-ico {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-weak); color: var(--primary);
}
.stat-label { font-size: 13px; color: var(--text-2); font-weight: 520; }
.stat-value { font-size: 27px; font-weight: 680; letter-spacing: -.4px; line-height: 1.15; }
.stat-value .unit { font-size: 14px; font-weight: 550; color: var(--muted); margin-left: 4px; }
.stat-foot { margin-top: 7px; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.stat-warn { color: var(--orange); font-weight: 560; }
.stat-danger { color: var(--red); font-weight: 560; }
.stat-ok { color: var(--green); font-weight: 560; }

/* ---------------- 徽标 ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 560; white-space: nowrap;
  background: var(--gray-bg); color: var(--gray);
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .75; }
.badge.no-dot::before { display: none; }
.badge-green  { background: var(--green-bg);  color: var(--green); }
.badge-red    { background: var(--red-bg);    color: var(--red); }
.badge-orange { background: var(--orange-bg); color: var(--orange); }
.badge-blue   { background: var(--blue-bg);   color: var(--blue); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-cyan   { background: var(--cyan-bg);   color: var(--cyan); }
.badge-gray   { background: var(--gray-bg);   color: var(--gray); }

.tag {
  display: inline-block; padding: 1px 8px; margin: 1px 4px 1px 0;
  border-radius: 5px; font-size: 11.5px;
  background: var(--gray-bg); color: var(--text-2);
}

.pill-group { display: inline-flex; background: var(--gray-bg); border-radius: 9px; padding: 3px; gap: 2px; }
.pill {
  padding: 5px 12px; border-radius: 7px; font-size: 13px; font-weight: 530;
  color: var(--text-2); cursor: pointer; border: none; background: transparent;
  transition: background .14s, color .14s;
}
.pill:hover { color: var(--text); }
.pill.active { background: var(--surface); color: var(--primary-dark); box-shadow: var(--shadow-1); font-weight: 600; }

/* ---------------- 工具条 ---------------- */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 13px 18px; border-bottom: 1px solid var(--border);
}
.toolbar .spacer { flex: 1; }
.search-box { position: relative; width: 250px; max-width: 100%; }
.search-box .input { padding-left: 33px; }
.search-box svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.data th {
  text-align: left; font-weight: 570; color: var(--text-2); font-size: 12.5px;
  padding: 10px 14px; background: var(--surface-2);
  border-bottom: 1px solid var(--border); white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--primary); }
table.data th .sort-mark { color: var(--muted); margin-left: 4px; font-size: 10px; }
table.data td {
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  vertical-align: middle; white-space: nowrap;
}
table.data tbody tr:hover td { background: #f8fafd; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data td.wrap { white-space: normal; min-width: 200px; }
table.data .col-check { width: 40px; padding-right: 0; }
table.data .col-act { width: 1%; text-align: right; }
table.data .cell-main { font-weight: 560; }
table.data .cell-sub { font-size: 12px; color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.linkish { color: var(--primary); cursor: pointer; }
.linkish:hover { text-decoration: underline; }
.secret { font-family: var(--mono); letter-spacing: .5px; color: var(--text-2); }

input[type="checkbox"].cb {
  width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; vertical-align: -2px;
}

/* ---------------- 空状态 / 分页 ---------------- */
.empty { padding: 56px 20px; text-align: center; color: var(--muted); }
.empty svg { opacity: .35; margin-bottom: 12px; }
.empty p { margin: 0 0 14px; font-size: 13.5px; }

.pager { display: flex; align-items: center; gap: 8px; padding: 13px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pager .pg-info { color: var(--muted); font-size: 12.5px; margin-right: auto; }
.pager .pg-btns { display: flex; gap: 4px; align-items: center; }
.pg-btn {
  min-width: 30px; height: 30px; padding: 0 7px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  font-size: 12.5px; cursor: pointer;
}
.pg-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pg-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.pg-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---------------- 弹窗 ---------------- */
.modal-root { position: fixed; inset: 0; z-index: 200; pointer-events: none; }
.modal-mask {
  position: absolute; inset: 0; background: rgba(24, 31, 47, .42);
  backdrop-filter: blur(2px); pointer-events: auto;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985); } }

.modal {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(680px, calc(100vw - 32px)); max-height: calc(100vh - 64px);
  background: var(--surface); border-radius: 15px; box-shadow: var(--shadow-3);
  display: flex; flex-direction: column; pointer-events: auto; overflow: hidden;
  animation: pop .18s cubic-bezier(.2,.8,.3,1);
}
.modal.wide { width: min(920px, calc(100vw - 32px)); }
.modal.narrow { width: min(430px, calc(100vw - 32px)); }
.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; border-bottom: 1px solid var(--border); flex: none;
}
.modal-title { font-size: 15.5px; font-weight: 640; }
.modal-close { margin-left: auto; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-foot {
  display: flex; gap: 10px; justify-content: flex-end; align-items: center;
  padding: 14px 20px; border-top: 1px solid var(--border); flex: none; background: var(--surface-2);
}
.modal-foot .left { margin-right: auto; }

/* ---------------- 表单栅格 ---------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-section {
  grid-column: 1 / -1; font-size: 12px; font-weight: 620; color: var(--muted);
  letter-spacing: .06em; text-transform: uppercase;
  padding: 16px 0 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px;
}
.form-section:first-child { padding-top: 0; }

/* ---------------- 到期提醒行 ---------------- */
.exp-list { display: flex; flex-direction: column; }
.exp-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 18px; border-bottom: 1px solid var(--border);
}
.exp-row:last-child { border-bottom: none; }
.exp-row:hover { background: var(--surface-2); }
.exp-ico {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--gray-bg); color: var(--text-2);
}
.exp-main { flex: 1; min-width: 0; }
.exp-name { font-weight: 560; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exp-meta { font-size: 12px; color: var(--muted); }
.exp-days { font-size: 13px; font-weight: 620; flex: none; }

/* ---------------- 图表 ---------------- */
.chart-legend { display: flex; flex-direction: column; gap: 9px; }
.legend-item { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.legend-label { flex: 1; color: var(--text-2); }
.legend-value { font-weight: 620; font-variant-numeric: tabular-nums; }

.bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 11px; }
.bar-label { width: 92px; flex: none; font-size: 12.5px; color: var(--text-2); text-align: right; }
.bar-track { flex: 1; height: 9px; border-radius: 6px; background: var(--gray-bg); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; transition: width .5s cubic-bezier(.2,.8,.3,1); }
.bar-value { width: 58px; flex: none; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------------- 提示 ---------------- */
.toast-wrap {
  position: fixed; right: 20px; bottom: 20px; z-index: 300;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
  pointer-events: none;
}
.toast {
  background: #232a3a; color: #fff; padding: 11px 16px; border-radius: 10px;
  font-size: 13.5px; box-shadow: var(--shadow-2); display: flex; align-items: center; gap: 9px;
  max-width: 400px; pointer-events: auto;
  animation: toastIn .22s cubic-bezier(.2,.8,.3,1);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }
.toast.out { opacity: 0; transform: translateY(6px); transition: all .22s; }
.toast-ok    { background: #14804c; }
.toast-error { background: #c93636; }
.toast-warn  { background: #b96f13; }

/* ---------------- 杂项 ---------------- */
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-wrap { flex-wrap: wrap; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

.kv { display: grid; grid-template-columns: 104px 1fr; gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }

.danger-zone { border-color: #f2c9c9; }
.danger-zone .card-head { border-bottom-color: #f2c9c9; background: #fffafa; }
.danger-zone .card-title { color: var(--red); }

.skeleton {
  background: linear-gradient(90deg, #eef0f5 25%, #f6f7fa 50%, #eef0f5 75%);
  background-size: 200% 100%; animation: sk 1.3s ease infinite; border-radius: 8px;
}
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------------- 下拉菜单 ---------------- */
.dropdown {
  position: fixed; z-index: 250; min-width: 158px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 11px; box-shadow: var(--shadow-2); padding: 5px;
  animation: pop .14s cubic-bezier(.2,.8,.3,1);
}
.dropdown-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 11px; border-radius: 8px;
  font-size: 13.5px; color: var(--text-2); cursor: pointer; text-decoration: none;
}
.dropdown-item:hover { background: var(--gray-bg); color: var(--text); text-decoration: none; }
.dropdown-item.is-danger { color: var(--red); }
.dropdown-item.is-danger:hover { background: var(--red-bg); color: var(--red); }

/* ---------------- 多选框组（checks 字段） ---------------- */
.check-group { display: flex; flex-wrap: wrap; gap: 8px 14px; padding: 6px 0 2px; }
.check-inline {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px; border: 1px solid var(--border-strong); border-radius: 8px;
  font-size: 13px; color: var(--text-2); cursor: pointer; background: var(--surface);
  transition: border-color .15s, background .15s;
}
.check-inline:hover { border-color: var(--primary); background: var(--primary-weak); }
.check-inline input { accent-color: var(--primary); margin: 0; }
.check-inline:has(input:checked) { border-color: var(--primary); background: var(--primary-weak); color: var(--text); }

/* ---------------- 通知设置 ---------------- */
.code-box {
  display: flex; align-items: center; gap: 10px;
  background: #1f2534; color: #e6eaf3; border-radius: 9px;
  padding: 10px 12px; font-family: var(--mono); font-size: 12.5px;
  overflow-x: auto;
}
.code-box code { flex: 1; white-space: nowrap; background: none; padding: 0; color: inherit; }
.code-box .icon-btn { color: #9aa4bb; flex: none; }
.code-box .icon-btn:hover { color: #fff; background: rgba(255, 255, 255, .12); }

.preview-box {
  margin: 0; padding: 14px 16px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 9px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.75;
  white-space: pre-wrap; word-break: break-word; max-height: 420px; overflow: auto;
  color: var(--text-2);
}

.chan-head { display: flex; align-items: center; gap: 10px; }
.chan-ico {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--gray-bg); color: var(--text-2);
}
.chan-meta { font-size: 11.5px; color: var(--muted); }
.chan-target { font-family: var(--mono); font-size: 12px; word-break: break-all; }

.dot-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.dot-status::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--gray);
  flex: none;
}
.dot-status.ok::before   { background: var(--green); }
.dot-status.fail::before { background: var(--red); }

.switch.is-sm .track { width: 34px; height: 19px; }
.switch.is-sm .track::after { width: 15px; height: 15px; top: 2px; left: 2px; }
.switch.is-sm input:checked + .track::after { transform: translateX(15px); }
.switch.is-sm .switch-text { display: none; }

/* ---------------- 分流规则编辑器 ---------------- */
.chan-tag {
  display: inline-block; margin-left: 6px; padding: 1px 6px;
  font-size: 10.5px; font-weight: 500; line-height: 1.6;
  border-radius: 5px; background: var(--gray-bg); color: var(--text-2);
  vertical-align: 1px;
}
.chan-tag.is-route { background: var(--primary-weak); color: var(--primary); }
.chan-tag.is-quiet { background: var(--purple-bg); color: var(--purple); }
.chan-tag.is-rate  { background: var(--orange-bg); color: var(--orange); }

/* ---------------- 通道专属动作弹窗（关注者导入 / 余额查询） ---------------- */
.action-body { display: block; }
.action-alert {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px; border-radius: 9px; margin-bottom: 12px;
  background: var(--red-bg); color: var(--red); font-size: 13px; line-height: 1.6;
}
.action-alert svg { flex: none; margin-top: 2px; }
.action-tools { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.action-tools .spacer { flex: 1; }
.action-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border);
}
.import-list {
  max-height: 320px; overflow: auto;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2);
}
.import-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--border);
}
.import-row:last-child { border-bottom: none; }
.import-row:hover { background: var(--surface); }
.import-row.is-picked { background: var(--primary-weak); }
.import-row input { accent-color: var(--primary); margin: 0; flex: none; }
.import-main { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.import-main code {
  font-size: 12.5px; background: none; padding: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px;
}
.import-main em { font-style: normal; font-size: 12px; color: var(--muted); }
.kv-list { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.kv-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.kv-row:last-child { border-bottom: none; }
.kv-row:nth-child(odd) { background: var(--surface-2); }
.kv-k { flex: none; width: 110px; font-size: 12.5px; color: var(--muted); }
.kv-v { font-size: 14px; font-weight: 600; color: var(--text); }
.kv-v.is-ok { color: var(--green); }
.kv-v.is-bad { color: var(--red); }
.kv-v.is-warn { color: var(--orange); }
.code-pre {
  margin: 0; padding: 10px 12px; border-radius: 9px;
  background: var(--gray-bg); color: var(--text-2);
  font-size: 12px; line-height: 1.65; white-space: pre-wrap; word-break: break-all;
  max-height: 220px; overflow: auto;
}

.route-editor { margin-top: 4px; }
.route-list { display: grid; gap: 12px; margin-bottom: 12px; }
.route-row {
  border: 1px solid var(--border); border-radius: 11px;
  padding: 12px 14px; background: var(--surface-2);
  display: grid; gap: 10px;
}
.route-head { display: flex; align-items: center; gap: 10px; }
.route-head .spacer { flex: 1; }
.route-idx { font-size: 12.5px; font-weight: 600; color: var(--text); }
.route-field { display: grid; gap: 5px; }
.route-label { font-size: 12px; color: var(--muted); }
.route-field .field-tip { margin-top: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit; font-size: 12px; line-height: 1.5;
  padding: 3px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  transition: border-color .15s, background .15s, color .15s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.is-on {
  border-color: var(--primary); background: var(--primary-weak);
  color: var(--primary); font-weight: 500;
}
.exp-meta.is-sub { margin-top: 3px; color: var(--text-2); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2-1, .grid-1-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100vh;
    transform: translateX(-100%); transition: transform .22s cubic-bezier(.2,.8,.3,1);
    box-shadow: var(--shadow-2);
  }
  .app.menu-open .sidebar { transform: translateX(0); }
  .app.menu-open .sidebar-mask { display: block; position: fixed; inset: 0; background: rgba(24,31,47,.4); z-index: 35; }
  .only-mobile { display: inline-flex !important; }
  .content { padding: 16px; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .search-box { width: 100%; }
  .topbar { padding: 0 14px; }
  .crumb .crumb-sub { display: none; }
}
