/* ==========================================================================
   Yuyang 控制台 · 设计系统
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --bg: #0d0f13;
  --bg-grad-1: rgba(77, 141, 245, .10);
  --bg-grad-2: rgba(167, 139, 250, .07);
  --surface: #121519;
  --card: #16191f;
  --card-2: #1b1f26;
  --elevated: #21262f;
  --fg: #eef1f6;
  --fg-2: #c7ced9;
  --muted: #8b94a3;
  --faint: #656e7c;
  --border: rgba(255, 255, 255, .075);
  --border-strong: rgba(255, 255, 255, .15);
  --hover: rgba(255, 255, 255, .045);
  --active: rgba(255, 255, 255, .07);
  --primary: #5b95f7;
  --primary-strong: #3f7ee8;
  --primary-soft: rgba(91, 149, 247, .14);
  --success: #3dd08c;
  --success-soft: rgba(61, 208, 140, .12);
  --warning: #f0b544;
  --warning-soft: rgba(240, 181, 68, .12);
  --danger: #f0707f;
  --danger-soft: rgba(240, 112, 127, .12);
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, .13);
  --cyan: #3cc7d8;
  --cyan-soft: rgba(60, 199, 216, .12);
  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 20px;
  --shadow: 0 22px 60px rgba(0, 0, 0, .5);
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, .28);
  --sidebar-w: 252px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", "JetBrains Mono", "Cascadia Code", Consolas, "Liberation Mono", monospace;
}

html[data-theme="light"] {
  --bg: #f3f5f9;
  --bg-grad-1: rgba(47, 111, 228, .09);
  --bg-grad-2: rgba(139, 92, 246, .07);
  --surface: #ffffff;
  --card: #ffffff;
  --card-2: #f7f9fc;
  --elevated: #ffffff;
  --fg: #101828;
  --fg-2: #344054;
  --muted: #667085;
  --faint: #98a2b3;
  --border: rgba(16, 24, 40, .09);
  --border-strong: rgba(16, 24, 40, .17);
  --hover: rgba(16, 24, 40, .035);
  --active: rgba(16, 24, 40, .06);
  --primary: #2f6fe4;
  --primary-strong: #1d5ed4;
  --primary-soft: rgba(47, 111, 228, .09);
  --success: #0f9d67;
  --success-soft: rgba(15, 157, 103, .1);
  --warning: #b7791f;
  --warning-soft: rgba(183, 121, 31, .12);
  --danger: #d64545;
  --danger-soft: rgba(214, 69, 69, .09);
  --violet: #7c5cf0;
  --violet-soft: rgba(124, 92, 240, .1);
  --cyan: #0e91a4;
  --cyan-soft: rgba(14, 145, 164, .1);
  --shadow: 0 24px 50px rgba(15, 23, 42, .13);
  --shadow-sm: 0 6px 18px rgba(15, 23, 42, .08);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; font-size: inherit; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }
img { max-width: 100%; display: block; }
svg { display: block; }
code, .mono { font-family: var(--mono); font-size: .92em; }
::selection { background: rgba(91, 149, 247, .28); }

body::-webkit-scrollbar, .main::-webkit-scrollbar, .sidebar__scroll::-webkit-scrollbar,
.log-list::-webkit-scrollbar, .table-wrap::-webkit-scrollbar, .modal__body::-webkit-scrollbar { width: 10px; height: 10px; }
body::-webkit-scrollbar-thumb, .main::-webkit-scrollbar-thumb, .sidebar__scroll::-webkit-scrollbar-thumb,
.log-list::-webkit-scrollbar-thumb, .table-wrap::-webkit-scrollbar-thumb, .modal__body::-webkit-scrollbar-thumb {
  background: rgba(140, 150, 165, .32); border-radius: 8px; border: 3px solid transparent; background-clip: content-box;
}
body::-webkit-scrollbar-track { background: transparent; }

/* ---------- Utilities ---------- */
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 8px; }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 6px; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.kicker {
  display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted);
}
.kicker--mono { font-family: var(--mono); letter-spacing: .12em; color: var(--primary); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.status-dot--ok { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.status-dot--warn { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
.status-dot--off { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--card-2);
  color: var(--fg); font-size: 13px; font-weight: 500; white-space: nowrap;
  cursor: pointer; transition: background .16s ease, border-color .16s ease, transform .12s ease, color .16s ease;
}
.btn:hover { background: var(--elevated); border-color: rgba(140, 150, 165, .40); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
.btn--primary { background: var(--primary-strong); border-color: transparent; color: #fff; box-shadow: 0 6px 18px rgba(63, 126, 232, .28); }
.btn--primary:hover { background: var(--primary); border-color: transparent; }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--fg-2); }
.btn--ghost:hover { background: var(--hover); color: var(--fg); }
.btn--danger { background: transparent; border-color: rgba(240, 112, 127, .38); color: var(--danger); }
.btn--danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn--soft { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.btn--sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn--xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 7px; }
.btn--block { width: 100%; }
.btn--icon { width: 36px; padding: 0; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid transparent;
  background: transparent; color: var(--muted); cursor: pointer; position: relative;
  transition: background .16s, color .16s;
}
.icon-btn:hover { background: var(--hover); color: var(--fg); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn[data-tip]::after {
  content: attr(data-tip); position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--elevated); color: var(--fg); border: 1px solid var(--border);
  padding: 5px 9px; border-radius: 7px; font-size: 11.5px; white-space: nowrap;
  opacity: 0; pointer-events: none; transform: translateY(-3px); transition: .15s; z-index: 60;
  box-shadow: var(--shadow-sm);
}
.icon-btn[data-tip]:hover::after { opacity: 1; transform: translateY(0); }

.link-btn {
  background: none; border: 0; padding: 0; color: var(--primary);
  font-size: 12.5px; cursor: pointer; text-decoration: none;
}
.link-btn:hover { text-decoration: underline; }

/* ---------- Fields ---------- */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); }
.field > span { font-weight: 500; }
.field input, .field select, .field textarea, .input {
  width: 100%; height: 36px; padding: 0 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--card-2); color: var(--fg);
  outline: none; transition: border-color .16s, box-shadow .16s, background .16s;
}
.field textarea, textarea.input { height: auto; padding: 10px 11px; line-height: 1.65; resize: vertical; min-height: 96px; }
textarea {
  width: 100%; padding: 10px 11px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--card-2); color: var(--fg); outline: none; resize: vertical; line-height: 1.65;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); background: var(--card); }
textarea::placeholder { color: var(--faint); }
.field input::placeholder, .field textarea::placeholder, .input::placeholder { color: var(--faint); }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); background: var(--card);
}
.field input:disabled, .field select:disabled { opacity: .6; cursor: not-allowed; }
.field--sm { font-size: 12px; gap: 5px; }
.field--sm input { height: 30px; font-size: 12.5px; }
.field-hint { font-size: 11.5px; color: var(--faint); line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.form-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.inline-field { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--muted); }
.inline-field input { width: 92px; height: 30px; padding: 0 9px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--card-2); color: var(--fg); outline: none; }
.inline-field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

select.input, .field select {
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b94a3' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px;
}

/* switch */
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 12.5px; color: var(--fg-2); user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
  width: 36px; height: 20px; border-radius: 999px; background: rgba(140, 150, 165, .28);
  position: relative; flex: none; transition: background .18s ease;
}
.switch__track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform .18s ease; box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
.switch input:checked + .switch__track { background: var(--primary-strong); }
.switch input:checked + .switch__track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 3px var(--primary-soft); }

/* checkbox */
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--fg-2); cursor: pointer; user-select: none; }
.check input { appearance: none; width: 15px; height: 15px; border-radius: 4.5px; border: 1.5px solid var(--border-strong); background: var(--card-2); cursor: pointer; position: relative; flex: none; transition: .15s; }
.check input:checked { background: var(--primary-strong); border-color: var(--primary-strong); }
.check input:checked::after {
  content: ""; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(42deg);
}
.check input:indeterminate { background: var(--primary-strong); border-color: var(--primary-strong); }
.check input:indeterminate::after { content: ""; position: absolute; left: 3px; top: 6px; width: 7px; height: 2px; background: #fff; border-radius: 2px; }
.checks { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; }

/* segmented */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--card-2); border: 1px solid var(--border); border-radius: 10px; }
.segmented button {
  height: 26px; padding: 0 11px; border: 0; background: transparent; color: var(--muted);
  font-size: 12.5px; border-radius: 7px; cursor: pointer; transition: .15s;
}
.segmented button:hover { color: var(--fg); }
.segmented button.is-active { background: var(--elevated); color: var(--fg); box-shadow: 0 1px 4px rgba(0, 0, 0, .18); }

/* badge / chip */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 8px;
  border-radius: 6px; font-size: 11.5px; font-weight: 500; white-space: nowrap;
  background: var(--hover); color: var(--muted);
}
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--warn { background: var(--warning-soft); color: var(--warning); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--info { background: var(--primary-soft); color: var(--primary); }
.badge--violet { background: var(--violet-soft); color: var(--violet); }
.badge--cyan { background: var(--cyan-soft); color: var(--cyan); }
.badge--neutral { background: var(--hover); color: var(--muted); }
.badge--outline { background: transparent; border: 1px solid var(--border-strong); color: var(--muted); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 27px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--card-2);
  font-size: 12px; color: var(--muted); white-space: nowrap;
}
.chip b { color: var(--fg); font-weight: 600; }
.chip--ok { border-color: rgba(61, 208, 140, .3); color: var(--success); background: var(--success-soft); }
.chip--warn { border-color: rgba(240, 181, 68, .3); color: var(--warning); background: var(--warning-soft); }

/* avatar */
.avatar {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, var(--primary), #6f5cf0);
  color: #fff; font-size: 12.5px; font-weight: 600; letter-spacing: .02em;
}
.avatar--lg { width: 40px; height: 40px; border-radius: 11px; font-size: 15px; }

/* ---------- Login ---------- */
.login {
  position: relative; min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 92px 24px 40px;
  overflow: hidden;
  background:
    radial-gradient(900px 520px at 12% -10%, var(--bg-grad-1), transparent 62%),
    radial-gradient(760px 480px at 96% 104%, var(--bg-grad-2), transparent 60%),
    var(--bg);
}
.login::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at 50% 45%, #000 10%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 45%, #000 10%, transparent 72%);
}
.login__glow { position: absolute; width: 560px; height: 560px; border-radius: 50%; filter: blur(120px); background: var(--primary); opacity: .10; top: -220px; left: 50%; transform: translateX(-50%); pointer-events: none; }
/* 左上角固定品牌栏：始终贴在视口左上角 */
.login__topbar {
  position: fixed; top: 0; left: 0; z-index: 5;
  display: flex; align-items: center; gap: 20px;
  padding: 22px 28px;
}
.login__back {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12.5px; color: var(--muted);
}
.login__back:hover { color: var(--fg); }
.login__back svg { width: 16px; height: 16px; }

/* 品牌图标（宇阳 ico）：白底圆角，深浅主题均清晰 */
.brand-mark--logo {
  background: #fff; padding: 6px; overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .18);
}
.brand-mark--logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.login__shell {
  position: relative; z-index: 2; width: 100%; max-width: 1060px;
  display: grid; grid-template-columns: minmax(0, 1fr) 428px; gap: 56px; align-items: center;
}
.login__intro { display: flex; flex-direction: column; gap: 38px; padding-right: 8px; }
.login__brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, var(--primary), #7c5cf0 92%);
  color: #fff; font-weight: 700; font-size: 17px; letter-spacing: .01em;
  box-shadow: 0 8px 20px rgba(63, 126, 232, .30);
}
.brand-mark--lg { width: 44px; height: 44px; border-radius: 13px; font-size: 19px; }
.login__brand strong { display: block; font-size: 16px; letter-spacing: .01em; }
.login__brand small { display: block; font-size: 11.5px; color: var(--muted); letter-spacing: .04em; }
.login__hero h1 { font-size: 42px; line-height: 1.22; letter-spacing: -.02em; margin: 14px 0 14px; font-weight: 650; }
.login__hero p { color: var(--muted); font-size: 14px; max-width: 380px; }
.login__features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--border); }
.login__features > div { background: var(--surface); padding: 16px 18px; display: flex; flex-direction: column; gap: 3px; }
.login__features span { font-size: 11.5px; color: var(--faint); letter-spacing: .03em; }
.login__features strong { font-size: 13.5px; font-weight: 550; }
.login__panel {
  background: color-mix(in srgb, var(--card) 82%, transparent);
  border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  padding: 30px 30px 26px; box-shadow: var(--shadow); backdrop-filter: blur(20px);
}
.login__welcome { font-size: 16px; font-weight: 650; letter-spacing: .02em; color: var(--fg); text-transform: none; }
.login__panel-head h2 { font-size: 23px; letter-spacing: -.01em; margin: 8px 0 0; }
.login__panel-head p { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.login__fields { display: flex; flex-direction: column; gap: 14px; margin: 24px 0 18px; }
.login__fields .field input { height: 40px; }
.login__error {
  font-size: 12.5px; color: var(--danger); background: var(--danger-soft);
  border: 1px solid rgba(240, 112, 127, .28); padding: 8px 11px; border-radius: 8px; margin-bottom: 12px;
}
.login__panel .btn--primary { height: 42px; border-radius: 10px; font-size: 13.5px; }
.login__note { margin-top: 14px; font-size: 11.5px; line-height: 1.6; color: var(--faint); text-align: center; }
.login__hint { margin-top: 18px; display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--faint); flex-wrap: wrap; }
.login__hint code { background: var(--hover); padding: 2px 6px; border-radius: 5px; color: var(--fg-2); }
.dot-sep { color: var(--faint); }
.login__hint .link-btn { margin-left: auto; }
.login__foot { position: relative; z-index: 2; margin-top: 44px; font-size: 11.5px; color: var(--faint); letter-spacing: .03em; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; background: var(--bg); }

.sidebar {
  width: var(--sidebar-w); flex: none; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; background: var(--surface);
  border-right: 1px solid var(--border); z-index: 40;
  transition: width .2s ease;
}
.sidebar .brand { display: flex; align-items: center; gap: 11px; padding: 20px 18px 18px; }
.brand-text small { display: block; font-size: 10.5px; letter-spacing: .14em; color: var(--faint); font-weight: 600; }
.brand-text strong { display: block; font-size: 14.5px; letter-spacing: .06em; font-weight: 600; }
.sidebar__scroll { flex: 1; overflow-y: auto; padding: 4px 12px 16px; }
.nav-caption {
  font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--faint); padding: 14px 10px 7px;
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 10px; height: 38px;
  padding: 0 10px; border-radius: 9px; color: var(--muted); font-size: 13px;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--hover); color: var(--fg); }
.nav a.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 550; }
.nav a.is-active::before {
  content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 2.5px;
  border-radius: 0 3px 3px 0; background: var(--primary);
}
.nav__icon { width: 18px; height: 18px; flex: none; }
.nav__icon svg { width: 18px; height: 18px; }
.nav__label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav__badge {
  min-width: 19px; height: 19px; padding: 0 6px; border-radius: 6px;
  background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
}
.sidebar__footer { border-top: 1px solid var(--border); padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.sidebar-status { display: flex; align-items: center; gap: 9px; padding: 7px 10px 11px; }
.sidebar-status strong { display: block; font-size: 12px; font-weight: 550; }
.sidebar-status small { display: block; font-size: 11px; color: var(--faint); }
.sidebar-action {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px;
  border: 0; background: transparent; color: var(--muted); border-radius: 8px;
  font-size: 12.5px; cursor: pointer; text-align: left;
}
.sidebar-action:hover { background: var(--hover); color: var(--fg); }
.sidebar-action svg { width: 16px; height: 16px; flex: none; }
.sidebar-action--danger:hover { background: var(--danger-soft); color: var(--danger); }

/* collapsed */
.app.is-collapsed .sidebar { width: 74px; }
.app.is-collapsed .brand-text,
.app.is-collapsed .nav-caption,
.app.is-collapsed .nav__label,
.app.is-collapsed .nav__badge,
.app.is-collapsed .sidebar-status div,
.app.is-collapsed .sidebar-action span { display: none; }
.app.is-collapsed .brand { justify-content: center; padding: 20px 0 18px; }
.app.is-collapsed .sidebar__scroll { padding: 4px 10px 16px; }
.app.is-collapsed .nav a { justify-content: center; padding: 0; }
.app.is-collapsed .nav a.is-active::before { display: none; }
.app.is-collapsed .nav { gap: 6px; }
.app.is-collapsed .sidebar-status { justify-content: center; padding: 7px 0 11px; }
.app.is-collapsed .sidebar-action { justify-content: center; padding: 0; }
.app.is-collapsed #sidebar-collapse svg { transform: rotate(180deg); }
.app.is-collapsed .nav a::after {
  content: attr(data-label); position: absolute; left: calc(100% + 10px); top: 50%;
  transform: translateY(-50%); background: var(--elevated); color: var(--fg);
  border: 1px solid var(--border); border-radius: 7px; padding: 5px 10px; font-size: 11.5px;
  white-space: nowrap; opacity: 0; pointer-events: none; transition: .15s; z-index: 50; box-shadow: var(--shadow-sm);
  max-width: 230px; overflow: hidden; text-overflow: ellipsis;
}
.app.is-collapsed .nav a:hover::after { opacity: 1; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: 66px; flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 0 26px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(18px);
}
.topbar__leading { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar__copy p { font-size: 11px; color: var(--faint); letter-spacing: .06em; text-transform: uppercase; }
.topbar__copy h1 { font-size: 16.5px; font-weight: 600; letter-spacing: -.005em; }
.topbar__mobile { display: none; }
.topbar__trailing { display: flex; align-items: center; gap: 6px; }
.glyph-moon { display: none; }
html[data-theme="dark"] .glyph-sun { display: none; }
html[data-theme="dark"] .glyph-moon { display: block; }

.quick-jump { position: relative; margin-right: 8px; }
.quick-jump__icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--faint); pointer-events: none; }
.quick-jump input {
  width: 196px; height: 32px; padding: 0 30px 0 32px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--card-2); color: var(--fg);
  font-size: 12.5px; outline: none; transition: .16s;
}
.quick-jump input:focus { width: 232px; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.quick-jump__kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: 10.5px; color: var(--faint);
  border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; line-height: 15px;
}
.quick-jump__menu {
  position: absolute; top: calc(100% + 8px); left: 0; width: 288px; z-index: 50;
  background: var(--elevated); border: 1px solid var(--border-strong); border-radius: 11px;
  box-shadow: var(--shadow); padding: 5px; max-height: 320px; overflow: auto;
}
.quick-jump__item { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 12.5px; }
.quick-jump__item:hover, .quick-jump__item.is-active { background: var(--primary-soft); color: var(--primary); }
.quick-jump__item small { margin-left: auto; color: var(--faint); font-size: 11px; }
.quick-jump__empty { padding: 14px 10px; text-align: center; color: var(--faint); font-size: 12px; }

.log-toggle__badge {
  position: absolute; top: 2px; right: 0; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 5px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
}

.user-menu { position: relative; }
.user-trigger {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 4px 0 10px;
  background: transparent; border: 1px solid transparent; border-radius: 10px; cursor: pointer;
}
.user-trigger:hover { background: var(--hover); border-color: var(--border); }
.user-trigger strong { font-size: 12.5px; font-weight: 550; }
.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); width: 292px; z-index: 50;
  background: var(--elevated); border: 1px solid var(--border-strong); border-radius: 13px;
  box-shadow: var(--shadow); overflow: hidden;
}
.user-dropdown__head { display: flex; align-items: center; gap: 11px; padding: 14px 15px; border-bottom: 1px solid var(--border); }
.user-dropdown__head strong { display: block; font-size: 13px; }
.user-dropdown__head small { display: block; font-size: 11.5px; color: var(--faint); }
.user-dropdown__body { padding: 13px 15px; display: flex; flex-direction: column; gap: 9px; }
.user-dropdown__foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 15px; border-top: 1px solid var(--border); font-size: 11px; color: var(--faint); }
.dropdown-sep { height: 1px; background: var(--border); margin: 4px 0; }
.cloud-account-info { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--r-sm); }
.cloud-account-info > span { font-size: 11px; color: var(--text-dim); }
.cloud-account-info > b { font-size: 13px; color: var(--text); word-break: break-all; }
.cloud-account-info > small { font-size: 10px; color: var(--text-dim); line-height: 1.5; }

/* ---------- Main / page ---------- */
.main { flex: 1; padding: 24px 26px 56px; min-width: 0; }
.page { max-width: 1480px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 2px; }
.page-head h2 { font-size: 21px; letter-spacing: -.01em; font-weight: 620; }
.page-head p { font-size: 12.5px; color: var(--muted); margin-top: 5px; max-width: 720px; line-height: 1.6; }
.page-head__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.section-head h3 { font-size: 14.5px; font-weight: 600; }
.section-head p { font-size: 12px; color: var(--faint); margin-top: 3px; }

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

/* ---------- Panel ---------- */
.panel {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; min-width: 0;
}
.panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 15px 18px; border-bottom: 1px solid var(--border);
}
.panel__head > div:first-child { min-width: 0; }
.panel__head h3 { font-size: 13.5px; font-weight: 600; letter-spacing: .005em; }
.panel__head p { font-size: 11.5px; color: var(--faint); margin-top: 3px; }
.panel__head .kicker { font-size: 10px; margin-bottom: 4px; }
.panel__body { padding: 18px; }
.panel__body--flush { padding: 0; }
.panel__body--tight { padding: 14px 16px; }
.panel__foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--card-2); }
.panel + .panel { margin-top: 0; }

/* stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat {
  position: relative; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 17px; overflow: hidden; min-width: 0;
}
.stat::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: radial-gradient(220px 90px at 100% 0, var(--stat-glow, transparent), transparent 70%); }
.stat__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stat__label { font-size: 11.5px; color: var(--muted); letter-spacing: .02em; }
.stat__icon { width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: var(--hover); color: var(--muted); }
.stat__icon svg { width: 15px; height: 15px; }
.stat__value { font-size: 26px; font-weight: 620; letter-spacing: -.02em; margin: 9px 0 3px; font-variant-numeric: tabular-nums; }
.stat__value small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 5px; letter-spacing: 0; }
.stat__foot { font-size: 11.5px; color: var(--faint); display: flex; align-items: center; gap: 6px; }
.stat--blue { --stat-glow: rgba(91, 149, 247, .13); }
.stat--blue .stat__icon { background: var(--primary-soft); color: var(--primary); }
.stat--green { --stat-glow: rgba(61, 208, 140, .11); }
.stat--green .stat__icon { background: var(--success-soft); color: var(--success); }
.stat--violet { --stat-glow: rgba(167, 139, 250, .12); }
.stat--violet .stat__icon { background: var(--violet-soft); color: var(--violet); }
.stat--amber { --stat-glow: rgba(240, 181, 68, .12); }
.stat--amber .stat__icon { background: var(--warning-soft); color: var(--warning); }

/* kv list */
.kv { display: flex; flex-direction: column; }
.kv__row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: 12.5px; }
.kv__row:last-child { border-bottom: 0; }
.kv__row > span { color: var(--muted); flex: none; }
.kv__row > b, .kv__row > div { font-weight: 500; text-align: right; word-break: break-all; }
.kv__row code { color: var(--fg); background: var(--hover); padding: 2px 6px; border-radius: 5px; }

/* copy field */
.copy-line {
  display: flex; align-items: center; gap: 8px; padding: 9px 11px; background: var(--card-2);
  border: 1px solid var(--border); border-radius: 9px; font-family: var(--mono); font-size: 11.5px;
  color: var(--fg-2); overflow: hidden;
}
.copy-line span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-line button { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 2px; flex: none; }
.copy-line button:hover { color: var(--primary); }
.copy-line button svg { width: 14px; height: 14px; }

/* tables */
.table-wrap { width: 100%; overflow: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.table thead th {
  position: sticky; top: 0; z-index: 2; background: var(--card-2);
  text-align: left; font-weight: 550; font-size: 11.5px; color: var(--muted);
  padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; letter-spacing: .02em;
}
.table tbody td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th:last-child, .table td:last-child { padding-right: 12px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--hover); }
.table tbody tr.is-selected { background: var(--primary-soft); }
.table--fixed { table-layout: fixed; }
.table--fixed tbody td { overflow: hidden; }
.table--fixed .cell-sub, .table--fixed .cell-main { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table th.t-right, .table td.t-right { text-align: right; }
.table th.t-center, .table td.t-center { text-align: center; }
.table td.t-mono { font-family: var(--mono); font-size: 11.8px; }
.cell-main { font-weight: 500; color: var(--fg); }
.cell-sub { font-size: 11px; color: var(--faint); margin-top: 2px; }
.cell-main .online-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--faint); opacity: .5; }
.cell-main .online-dot.is-on { background: var(--success); opacity: 1; box-shadow: 0 0 0 3px var(--success-soft); }
.form-caption { font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); margin: 0 0 10px; }
.form-caption:not(:first-child) { margin-top: 18px; }
.row-actions { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.icon-action {
  width: 28px; height: 26px; border-radius: 6px; border: 1px solid transparent; background: transparent;
  color: var(--fg-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.icon-action:hover { background: var(--hover); color: var(--fg); border-color: var(--border); }
.icon-action svg { width: 15px; height: 15px; }
.icon-action--danger:hover { color: var(--danger); background: var(--danger-soft); }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.pager { display: flex; align-items: center; gap: 4px; }
.pager button { min-width: 27px; height: 27px; padding: 0 7px; border-radius: 7px; border: 1px solid var(--border); background: var(--card-2); color: var(--muted); font-size: 12px; cursor: pointer; }
.pager button:hover:not(:disabled) { color: var(--fg); border-color: var(--border-strong); }
.pager button.is-active { background: var(--primary-soft); border-color: transparent; color: var(--primary); font-weight: 600; }
.pager button:disabled { opacity: .4; cursor: not-allowed; }

.selection-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 14px; background: var(--primary-soft); border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--primary);
}
.selection-bar strong { font-weight: 600; }
.selection-bar .spacer { flex: 1; }

/* empty */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 42px 20px; text-align: center; color: var(--faint); }
.empty svg { width: 30px; height: 30px; opacity: .5; }
.empty strong { font-size: 13px; color: var(--muted); font-weight: 550; }
.empty p { font-size: 12px; }

/* ---------- Monitor ---------- */
.monitor-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.resource {
  border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--card-2);
  display: flex; align-items: center; gap: 14px; min-width: 0;
}
.ring { position: relative; width: 78px; height: 78px; flex: none; }
.ring svg { width: 78px; height: 78px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring__track { stroke: var(--hover); }
.ring__value { stroke: var(--primary); stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.ring--green .ring__value { stroke: var(--success); }
.ring--amber .ring__value { stroke: var(--warning); }
.ring--violet .ring__value { stroke: var(--violet); }
.ring__label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring__label strong { font-size: 15px; font-weight: 620; font-variant-numeric: tabular-nums; }
.ring__label small { font-size: 9.5px; color: var(--faint); letter-spacing: .04em; }
.resource__info { min-width: 0; flex: 1; }
.resource__info h4 { font-size: 12.5px; font-weight: 600; margin-bottom: 3px; }
.resource__info p { font-size: 11px; color: var(--faint); line-height: 1.6; }
.cores { display: flex; gap: 2.5px; margin-top: 7px; height: 22px; align-items: flex-end; }
.cores i { flex: 1; border-radius: 2px; background: var(--primary); opacity: .75; min-width: 2px; transition: height .45s ease; }
.core-labels { display: flex; justify-content: space-between; font-size: 10px; color: var(--faint); margin-top: 4px; }

.proc-table { font-size: 11.8px; }
.proc-table td { padding: 7px 10px; }
.proc-bar { height: 4px; border-radius: 3px; background: var(--hover); overflow: hidden; min-width: 54px; }
.proc-bar i { display: block; height: 100%; background: var(--primary); border-radius: 3px; }

/* charts */
.chart { width: 100%; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart-legend { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.chart-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 3px; margin-right: 5px; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--elevated); border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 7px 10px; font-size: 11.5px; box-shadow: var(--shadow-sm); z-index: 20;
  white-space: nowrap; transform: translate(-50%, -100%); opacity: 0; transition: opacity .12s;
}
.chart-wrap { position: relative; }

/* progress list */
.metric-list { display: flex; flex-direction: column; gap: 12px; }
.metric-row { display: flex; align-items: center; gap: 12px; font-size: 12px; }
.metric-row__label { width: 92px; flex: none; color: var(--muted); }
.metric-row__bar { flex: 1; height: 6px; background: var(--hover); border-radius: 4px; overflow: hidden; }
.metric-row__bar i { display: block; height: 100%; border-radius: 4px; background: var(--primary); transition: width .5s ease; }
.metric-row b { width: 48px; text-align: right; font-weight: 550; font-variant-numeric: tabular-nums; }

/* code block */
.code {
  background: #0a0d11; color: #c9d4e3; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; font-family: var(--mono); font-size: 11.5px; line-height: 1.75;
  overflow: auto; white-space: pre; tab-size: 2;
}
html[data-theme="light"] .code { background: #0f172a; color: #d6e0ee; }
.code .c-key { color: #7dd3fc; }
.code .c-str { color: #a5e6a5; }
.code .c-num { color: #f0b544; }
.code .c-mut { color: #6b7c92; }

/* log drawer */
.drawer { position: fixed; inset: 0; z-index: 90; }
.drawer__backdrop { position: absolute; inset: 0; background: rgba(4, 6, 10, .55); backdrop-filter: blur(2px); }
.drawer__panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(620px, 100%);
  background: var(--surface); border-left: 1px solid var(--border-strong);
  display: flex; flex-direction: column; box-shadow: -22px 0 60px rgba(0, 0, 0, .35);
  animation: drawer-in .22s ease;
}
@keyframes drawer-in { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; }
.drawer__head h2 { font-size: 16px; font-weight: 600; margin-top: 2px; }
.drawer__toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 18px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.drawer__tools { display: flex; align-items: center; gap: 7px; }
.log-list { flex: 1; overflow-y: auto; padding: 8px 12px 20px; }
.log-item {
  display: grid; grid-template-columns: 62px 1fr auto; gap: 8px; align-items: baseline;
  padding: 7px 8px; border-radius: 7px; font-family: var(--mono); font-size: 11.3px; line-height: 1.5;
}
.log-item:hover { background: var(--hover); }
.log-item__time { color: var(--faint); font-size: 10.8px; }
.log-item__msg { color: var(--fg-2); word-break: break-word; }
.log-item__meta { color: var(--faint); font-size: 10.5px; text-align: right; white-space: nowrap; }
.log-level { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.log-level--success { background: var(--success); }
.log-level--error { background: var(--danger); }
.log-level--warn { background: var(--warning); }
.log-method { color: var(--primary); font-weight: 600; font-size: 10.5px; margin-right: 5px; }
.log-path { color: var(--fg); }

/* toast */
.toast-stack { position: fixed; bottom: 22px; right: 22px; z-index: 120; display: flex; flex-direction: column; gap: 9px; max-width: 380px; }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 13px;
  background: var(--elevated); border: 1px solid var(--border-strong); border-radius: 11px;
  box-shadow: var(--shadow); animation: toast-in .22s ease;
}
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast.is-out { animation: toast-out .18s ease forwards; }
@keyframes toast-out { to { transform: translateY(8px); opacity: 0; } }
.toast__icon { width: 20px; height: 20px; border-radius: 6px; flex: none; display: inline-flex; align-items: center; justify-content: center; margin-top: 1px; }
.toast__icon svg { width: 13px; height: 13px; }
.toast--success .toast__icon { background: var(--success-soft); color: var(--success); }
.toast--error .toast__icon { background: var(--danger-soft); color: var(--danger); }
.toast--info .toast__icon { background: var(--primary-soft); color: var(--primary); }
.toast--warn .toast__icon { background: var(--warning-soft); color: var(--warning); }
.toast__body { min-width: 0; }
.toast__body strong { display: block; font-size: 12.5px; font-weight: 600; }
.toast__body span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.5; word-break: break-word; }
.toast__close { margin-left: auto; border: 0; background: transparent; color: var(--faint); cursor: pointer; font-size: 15px; line-height: 1; padding: 2px; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 110; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(4, 6, 10, .58); backdrop-filter: blur(3px); }
.modal__panel {
  position: relative; width: 100%; max-width: 460px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: var(--shadow);
  animation: modal-in .2s ease; overflow: hidden;
}
.modal--wide .modal__panel { max-width: 720px; }
@keyframes modal-in { from { transform: translateY(12px) scale(.99); opacity: 0; } to { transform: none; opacity: 1; } }
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 18px 20px 0; }
.modal__head h3 { font-size: 15.5px; font-weight: 600; }
.modal__head p { font-size: 12.5px; color: var(--muted); margin-top: 5px; line-height: 1.6; }
.modal__body { padding: 16px 20px; max-height: 62vh; overflow-y: auto; }
.modal__foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 13px 20px; border-top: 1px solid var(--border); background: var(--card-2); }
.modal__foot .spacer { flex: 1; }

/* menu (row action dropdown) */
.menu {
  position: fixed; z-index: 115; min-width: 178px; background: var(--elevated);
  border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow);
  padding: 5px; max-height: 340px; overflow: auto;
}
.menu__item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 9px; border: 0; background: transparent; color: var(--fg-2); border-radius: 7px; font-size: 12.5px; cursor: pointer; text-align: left; }
.menu__item:hover { background: var(--hover); color: var(--fg); }
.menu__item--danger { color: var(--danger); }
.menu__item--danger:hover { background: var(--danger-soft); color: var(--danger); }
.menu__sep { height: 1px; background: var(--border); margin: 4px 0; }
.menu__group { padding: 6px 9px 3px; font-size: 10.5px; color: var(--faint); letter-spacing: .06em; text-transform: uppercase; }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 18px; overflow-x: auto; }
.tab {
  position: relative; height: 42px; padding: 0 12px; border: 0; background: none;
  color: var(--muted); font-size: 12.8px; cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--fg); }
.tab.is-active { color: var(--fg); font-weight: 550; }
.tab.is-active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--primary); border-radius: 2px 2px 0 0; }

/* misc blocks */
.note {
  display: flex; gap: 10px; padding: 11px 13px; border-radius: 10px;
  background: var(--primary-soft); border: 1px solid rgba(91, 149, 247, .2);
  font-size: 12px; color: var(--fg-2); line-height: 1.65;
}
.note svg { width: 15px; height: 15px; flex: none; color: var(--primary); margin-top: 2px; }
.note--warn { background: var(--warning-soft); border-color: rgba(240, 181, 68, .24); }
.note--warn svg { color: var(--warning); }
.note--danger { background: var(--danger-soft); border-color: rgba(240, 112, 127, .24); }
.note--danger svg { color: var(--danger); }
.danger-zone { border: 1px solid rgba(240, 112, 127, .22); border-radius: var(--radius); background: rgba(240, 112, 127, .04); }

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

/* file browser */
.file-layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 420px; }
.file-tree { border-right: 1px solid var(--border); padding: 12px 10px; background: var(--card-2); }
.tree-item { display: flex; align-items: center; gap: 7px; padding: 6px 8px; border-radius: 7px; font-size: 12px; color: var(--fg-2); cursor: pointer; }
.tree-item:hover { background: var(--hover); }
.tree-item.is-active { background: var(--primary-soft); color: var(--primary); }
.tree-item svg { width: 14px; height: 14px; flex: none; opacity: .7; }
.tree-item small { margin-left: auto; color: var(--faint); font-size: 10.5px; }
.file-main { display: flex; flex-direction: column; min-width: 0; }
.file-toolbar { display: flex; align-items: center; gap: 7px; padding: 10px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.file-crumbs { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); padding: 9px 14px; border-bottom: 1px solid var(--border); font-family: var(--mono); }
.file-crumbs b { color: var(--fg); font-weight: 500; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--border); font-size: 12.5px; cursor: default; }
.file-row:hover { background: var(--hover); }
.file-row.is-selected { background: var(--primary-soft); }
.file-row.is-dir { cursor: pointer; }
.file-row__name { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.file-row__name svg { width: 15px; height: 15px; color: var(--faint); flex: none; }
.file-row__name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row__meta { color: var(--faint); font-size: 11.5px; white-space: nowrap; }

/* community */
.msg-list { display: flex; flex-direction: column; gap: 9px; max-height: 372px; overflow-y: auto; padding: 4px 2px; }
.msg { display: flex; gap: 9px; align-items: flex-start; }
.msg__avatar { width: 26px; height: 26px; border-radius: 8px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; background: var(--primary-soft); color: var(--primary); }
.msg__body { min-width: 0; }
.msg__meta { font-size: 11px; color: var(--faint); display: flex; gap: 7px; align-items: baseline; margin-bottom: 2px; }
.msg__meta b { color: var(--fg-2); font-weight: 550; font-size: 11.5px; }
.msg__text { font-size: 12.5px; color: var(--fg-2); background: var(--card-2); border: 1px solid var(--border); padding: 7px 10px; border-radius: 4px 10px 10px 10px; line-height: 1.55; word-break: break-word; }
.msg--system .msg__text { background: var(--warning-soft); border-color: rgba(240, 181, 68, .2); }
.msg__del { margin-left: auto; flex: none; opacity: .35; }
.msg:hover .msg__del { opacity: 1; }

/* community: full-width policy strip + three-column cards */
.community-policy__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 14px; align-items: end; }
.community-policy .inline-field { white-space: nowrap; }
.community-policy .inline-field input, .community-policy .inline-field select { width: 100%; min-width: 0; }
.community-cards { align-items: start; }
.community-card .msg-list { max-height: 340px; }
.community-card .table-wrap { max-height: 340px; overflow-y: auto; }
.community-card .empty { color: var(--faint); text-align: center; }
.community-card .empty strong { display: block; font-size: 13px; color: var(--fg-2); margin: 8px 0 4px; }
.community-card .empty span { font-size: 11.5px; }
@media (max-width: 1400px) { .community-policy__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .community-policy__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .community-policy__grid { grid-template-columns: minmax(0, 1fr); } }

/* community: user governance + room cards */
.community-search { width: 100%; height: 32px; font-size: 12.5px; margin-bottom: 10px; }
.comm-user-list, .comm-room-list { max-height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.comm-user { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; background: var(--card-2); display: flex; flex-direction: row; align-items: center; gap: 10px; }
.comm-user__main { flex: 1; min-width: 0; }
.comm-user__main .cell-main { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.comm-user__main .cell-sub { margin-top: 3px; font-size: 11px; color: var(--muted); }
.comm-user__side { flex: none; display: flex; align-items: center; gap: 8px; }
.comm-user__state { display: flex; align-items: center; min-height: 18px; }
.comm-user__ops { display: flex; align-items: center; gap: 6px; }
.comm-user__ops .btn { flex: none; }
.comm-switch { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; cursor: pointer; font-size: 11px; color: var(--muted); user-select: none; }
.comm-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.comm-switch__track { position: relative; width: 26px; height: 15px; border-radius: 9px; background: var(--border-strong); transition: background .18s; flex: none; }
.comm-switch__track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%; background: #fff; transition: transform .18s; }
.comm-switch input:checked + .comm-switch__track { background: var(--primary); }
.comm-switch input:checked + .comm-switch__track::after { transform: translateX(11px); }
.comm-switch input:focus-visible + .comm-switch__track { box-shadow: 0 0 0 3px var(--primary-soft); }
.community-search-join { display: flex; gap: 6px; margin-bottom: 10px; }
.community-search-join .input { flex: 1; min-width: 0; height: 32px; font-size: 12.5px; }
.community-search-join .btn { flex: none; }
.comm-room { border: 1px solid var(--border); border-radius: 10px; padding: 10px; background: var(--card-2); }
.comm-room__head { display: flex; align-items: flex-start; gap: 8px; }
.comm-room__icon { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-size: 14px; flex: none; }
.comm-room__title { flex: 1; min-width: 0; }
.comm-room__title .cell-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }
.comm-room__head .icon-action { flex: none; }
.comm-room__meta { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; margin-left: auto; font-size: 10.5px; line-height: 1.35; color: var(--muted); white-space: nowrap; }
.comm-room__meta b { color: var(--fg); font-weight: 600; }
.comm-room__notice { margin-top: 7px; font-size: 11px; color: var(--muted); background: var(--warning-soft); border-radius: 6px; padding: 6px 8px; line-height: 1.5; }

/* API 配置导出弹窗 */
.api-export-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.api-export-preview { width: 100%; height: 360px; font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace); font-size: 12px; line-height: 1.6; white-space: pre; overflow: auto; resize: vertical; tab-size: 2; }

/* plugin cards */
.plugin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.plugin-card { border: 1px solid var(--border); border-radius: 11px; padding: 13px; background: var(--card-2); display: flex; flex-direction: column; gap: 9px; }
.plugin-card__head { display: flex; align-items: center; gap: 10px; }
.plugin-logo { width: 34px; height: 34px; border-radius: 9px; flex: none; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; background: var(--violet-soft); color: var(--violet); }
.plugin-card__head strong { display: block; font-size: 13px; font-weight: 600; }
.plugin-card__head small { display: block; font-size: 11px; color: var(--faint); }
.plugin-card__desc { font-size: 12px; color: var(--muted); line-height: 1.6; min-height: 38px; }
.plugin-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* products */
.product-row { display: grid; grid-template-columns: 190px minmax(0, 1fr) 120px 90px 96px; gap: 12px; align-items: center; padding: 11px 16px; border-bottom: 1px solid var(--border); }
.product-row:last-child { border-bottom: 0; }
.product-key { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.product-row input[type="text"], .product-row input[type="number"] {
  width: 100%; height: 32px; padding: 0 9px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card-2); color: var(--fg); font-size: 12.5px; outline: none;
}
.product-row input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* product cards (catalog editor) */
.product-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(212px, 1fr)); gap: 12px; }
.product-card {
  display: flex; flex-direction: column; gap: 11px; min-width: 0;
  padding: 14px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--card-2); transition: border-color .15s, box-shadow .15s;
}
.product-card:hover { border-color: var(--primary); box-shadow: 0 3px 14px rgba(0, 0, 0, .06); }
.product-card.is-off { opacity: .72; }
.product-card__head { display: flex; align-items: center; gap: 10px; min-width: 0; padding-bottom: 11px; border-bottom: 1px solid var(--border); }
.product-card__icon {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700;
}
.product-card__icon--green { background: rgba(61, 208, 140, .14); color: #2fae72; }
.product-card__icon--violet { background: rgba(160, 130, 245, .16); color: #9a76e8; }
.product-card__icon--blue { background: rgba(96, 165, 250, .16); color: #5b9bf5; }
.product-card__id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.product-card__id strong { font-size: 13px; color: var(--fg); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-card__id span { font-family: var(--mono); font-size: 10.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-card .field { gap: 5px; }
.product-card .field > span { font-size: 11px; color: var(--muted); font-weight: 550; }
.product-card .field input {
  width: 100%; height: 32px; padding: 0 9px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); color: var(--fg); font-size: 12.5px; outline: none;
}
.product-card .field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.product-card__fixed {
  display: flex; align-items: flex-start; gap: 6px; min-height: 32px; padding: 7px 9px;
  border-radius: 8px; background: rgba(61, 208, 140, .1); border: 1px solid rgba(61, 208, 140, .22);
  color: var(--success); font-size: 10.5px; line-height: 1.5;
}
.product-card__fixed svg { width: 13px; height: 13px; flex: none; margin-top: 1px; }
.product-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 2px; }
.product-card__foot .btn { min-width: 62px; }

/* carousel */
.carousel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.slide-card { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--card-2); }
.slide-card__img { aspect-ratio: 16 / 9; width: 100%; object-fit: cover; display: block; background: linear-gradient(135deg, var(--primary-soft), var(--violet-soft)); }
.slide-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 7px 9px; font-size: 11px; color: var(--muted); }
.upload-box {
  border: 1.5px dashed var(--border-strong); border-radius: 11px; padding: 18px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  color: var(--muted); font-size: 12px; cursor: pointer; text-align: center; min-height: 108px;
  transition: .16s; background: var(--card-2);
}
.upload-box:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.upload-box svg { width: 20px; height: 20px; }
.upload-box small { font-size: 10.5px; color: var(--faint); }

/* api table (about) */
.api-table td { padding: 8px 12px; font-size: 12px; }
.api-method { font-family: var(--mono); font-size: 10.5px; font-weight: 600; padding: 2px 5px; border-radius: 4px; background: var(--hover); color: var(--muted); }
.api-method--get { color: var(--success); background: var(--success-soft); }
.api-method--post { color: var(--primary); background: var(--primary-soft); }
.api-path { font-family: var(--mono); font-size: 11.5px; color: var(--fg-2); }

/* responsive */
@media (max-width: 1280px) {
  .grid--sidebar { grid-template-columns: minmax(0, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--main-side, .grid--2, .grid--3, .split-3 { grid-template-columns: minmax(0, 1fr); }
  .monitor-grid { grid-template-columns: minmax(0, 1fr); }
  .login__shell { grid-template-columns: minmax(0, 1fr); gap: 36px; max-width: 520px; }
  .login__intro { gap: 24px; }
  .login__hero h1 { font-size: 32px; }
  .login__features { display: none; }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow); }
  .app.is-mobile-open .sidebar { transform: none; }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(4, 6, 10, .5); z-index: 35; }
  .topbar__mobile { display: inline-flex; }
  .main { padding: 18px 16px 48px; }
  .topbar { padding: 0 14px; }
  .quick-jump { display: none; }
  .stat-grid, .grid--4, .split-2, .plugin-grid, .form-grid--2, .form-grid--3, .form-grid--4 { grid-template-columns: minmax(0, 1fr); }
  .file-layout { grid-template-columns: minmax(0, 1fr); }
  .file-tree { border-right: 0; border-bottom: 1px solid var(--border); max-height: 180px; overflow: auto; }
  .product-row { grid-template-columns: minmax(0, 1fr) 80px; row-gap: 8px; }
  .product-row .product-key { grid-column: 1 / -1; }
  .topbar__copy h1 { font-size: 15px; }
  .toast-stack { left: 14px; right: 14px; bottom: 14px; max-width: none; }
}
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: minmax(0, 1fr); }
  .page-head h2 { font-size: 18px; }
  .login { padding: 96px 16px 32px; }
  .login__topbar { padding: 16px; gap: 12px; }
  .login__panel { padding: 22px 20px; }
  .login__hero h1 { font-size: 27px; }
}

/* ---------- Access Control / 管理员与权限 ---------- */
.chip svg { width: 13px; height: 13px; vertical-align: -2px; margin-right: 4px; }
.note--info { background: var(--primary-soft); border-color: rgba(96, 165, 250, .24); }
.note--info svg { color: var(--primary); }
.acl-summary {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card-2);
}
.acl-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.acl-identity__text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.acl-identity__text strong { font-size: 15px; color: var(--fg); }
.acl-identity__text small { font-size: 11px; color: var(--faint); }
.acl-identity__text code { font-family: var(--mono); font-size: 10.5px; }
.acl-role {
  align-self: flex-start; display: inline-block; padding: 2px 8px; border-radius: 5px;
  font-size: 11px; font-weight: 600; color: var(--success);
  background: var(--success-soft); border: 1px solid rgba(61, 208, 140, .3);
}
.acl-stats { display: flex; gap: 0; flex-wrap: wrap; }
.acl-stats > div {
  display: flex; flex-direction: column; gap: 3px; padding: 0 22px;
  border-left: 1px solid var(--border); min-width: 96px;
}
.acl-stats > div:first-child { border-left: 0; padding-left: 0; }
.acl-stats b { font-size: 18px; color: var(--fg); font-weight: 600; }
.acl-stats span { font-size: 11px; color: var(--muted); }
.acl-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.acl-group { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.acl-group__head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 13px; background: var(--card-2); border-bottom: 1px solid var(--border);
  font-size: 12.5px; font-weight: 600; color: var(--fg);
}
.acl-group__head i { font-style: normal; color: var(--primary); margin-right: 7px; }
.acl-group__count { font-size: 10.5px; font-weight: 500; color: var(--success); }
.acl-items { padding: 4px 13px; }
.acl-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.acl-item:last-child { border-bottom: 0; }
.acl-item__check { display: inline-flex; color: var(--success); flex: none; }
.acl-item__check svg { width: 13px; height: 13px; }
.acl-item--off { opacity: .5; }
.acl-item--off .acl-item__check { color: var(--faint); }
.acl-item__label { flex: 1; min-width: 0; font-size: 11.5px; color: var(--fg-2); }
.acl-item__id {
  font-family: var(--mono); font-size: 10px; color: var(--faint);
  background: var(--card-2); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; white-space: nowrap;
}
@media (max-width: 900px) {
  .acl-groups { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 620px) {
  .acl-summary { flex-direction: column; align-items: stretch; }
  .acl-stats > div { flex: 1; padding: 0 10px; min-width: 0; text-align: center; }
  .acl-stats > div:first-child { padding-left: 10px; }
  .acl-item { flex-wrap: wrap; }
  .acl-item__id { margin-left: 21px; }
}

/* ==========================================================================
   Tenant Management / 租户管理
   ========================================================================== */
.stat--primary { --stat-glow: rgba(91, 149, 247, .12); }
.stat--primary .stat__icon { background: var(--primary-soft); color: var(--primary); }
.tenant-intro p { margin: 0 0 9px; font-size: 12px; line-height: 1.75; color: var(--fg-2); }
.tenant-intro p:last-child { margin-bottom: 0; }
.tenant-intro b.mono { color: var(--fg); font-weight: 600; }
.code-block { margin-top: 12px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #0f172a; }
.code-block__head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 12px; background: #16203a; border-bottom: 1px solid rgba(255, 255, 255, .08);
  font-size: 11px; color: #94a3b8;
}
.code-block__head .link-btn { color: #7dd3fc; }
.code-block pre { margin: 0; padding: 12px 14px; overflow: auto; }
.code-block code { font-family: var(--mono); font-size: 11.5px; line-height: 1.7; color: #d6e0ee; white-space: pre; }
.select-sm {
  height: 30px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card-2); color: var(--fg); font-size: 12px; outline: none;
}
.select-sm:focus { border-color: var(--primary); }
.table tbody tr.is-current { background: var(--primary-soft); }
.quota-cell { display: flex; flex-direction: column; gap: 4px; }
.quota-cell__bar { height: 5px; border-radius: 4px; background: var(--border); overflow: hidden; }
.quota-cell__bar span { display: block; height: 100%; border-radius: 4px; background: var(--primary); transition: width .25s; }
.quota-cell .small { font-size: 10px; }
.policy-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--card-2);
}
.policy-head__title { font-size: 13px; font-weight: 600; color: var(--fg); margin-bottom: 3px; }
.policy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin-top: 12px; }
.policy-item {
  display: flex; align-items: center; gap: 9px; padding: 11px 12px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 10px; background: var(--card); transition: .15s;
}
.policy-item:hover { border-color: var(--primary); }
.policy-item.is-on { border-color: rgba(91, 149, 247, .45); background: var(--primary-soft); }
.policy-item input { position: absolute; opacity: 0; width: 0; height: 0; }
.policy-item__box {
  width: 18px; height: 18px; flex: none; border-radius: 5px; border: 1.5px solid var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; color: transparent; transition: .15s;
}
.policy-item.is-on .policy-item__box { background: var(--primary-strong); border-color: var(--primary-strong); color: #fff; }
.policy-item__box svg { width: 12px; height: 12px; }
.policy-item__text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.policy-item__text strong { font-size: 12px; color: var(--fg); font-weight: 600; }
.policy-item__text small { font-size: 10px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.policy-item__count {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  background: var(--card-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; flex: none;
}
.policy-quota { display: grid; grid-template-columns: minmax(0, 240px) minmax(0, 1fr); gap: 20px; align-items: end; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.quota-meter__label { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.quota-meter__label b { color: var(--fg); font-weight: 600; }
@media (max-width: 720px) {
  .policy-quota { grid-template-columns: minmax(0, 1fr); gap: 12px; }
}

/* ==========================================================================
   API 配置 / API Configuration
   ========================================================================== */
.api-toolbar { margin-bottom: 16px; }
.api-toolbar__row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.api-toolbar__row + .api-toolbar__row { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.api-toolbar__row .input { flex: 1; min-width: 220px; height: 34px; }
.api-cats { display: flex; gap: 6px; flex-wrap: wrap; }
.api-cat {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 8px; background: var(--card);
  color: var(--muted); font-size: 12px; transition: .15s;
}
.api-cat:hover { border-color: var(--primary); color: var(--fg); }
.api-cat.is-active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.api-cat span { font-family: var(--mono); font-size: 10px; opacity: .8; }

.api-groups { display: flex; flex-direction: column; gap: 14px; }
.api-group { overflow: visible; }
.api-group__head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 16px; cursor: pointer; user-select: none; transition: background .15s;
}
.api-group__head:hover { background: var(--hover); }
.api-group__title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.api-group__icon {
  width: 36px; height: 36px; flex: none; border-radius: 9px; display: inline-flex;
  align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary);
}
.api-group__icon svg { width: 18px; height: 18px; }
.api-group--green .api-group__icon { background: var(--success-soft); color: var(--success); }
.api-group--amber .api-group__icon { background: var(--warning-soft); color: var(--warning); }
.api-group--violet .api-group__icon { background: var(--violet-soft); color: var(--violet); }
.api-group--cyan .api-group__icon { background: rgba(56, 189, 248, .12); color: #38bdf8; }
.api-group__title h3 { font-size: 14px; font-weight: 600; color: var(--fg); margin: 0 0 2px; }
.api-group__title p { font-size: 11.5px; color: var(--faint); margin: 0; }
.api-group__meta { display: flex; align-items: center; gap: 12px; flex: none; }
.api-group__bar { width: 120px; height: 6px; border-radius: 4px; background: var(--hover); overflow: hidden; }
.api-group__bar i { display: block; height: 100%; border-radius: 4px; background: var(--primary); transition: width .4s; }
.api-group--green .api-group__bar i { background: var(--success); }
.api-group--amber .api-group__bar i { background: var(--warning); }
.api-group--violet .api-group__bar i { background: var(--violet); }
.api-group--cyan .api-group__bar i { background: #38bdf8; }
.api-group__count { font-family: var(--mono); font-size: 12px; color: var(--fg); font-weight: 600; min-width: 48px; text-align: right; }
.api-group__items { font-size: 11px; color: var(--faint); }
.api-group__chevron { color: var(--muted); font-size: 13px; width: 16px; text-align: center; }
.api-group__body { padding: 0 16px 16px; border-top: 1px solid var(--border); }
.api-group.is-collapsed .api-group__head { border-radius: inherit; }

.ep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(430px, 1fr)); gap: 9px; padding-top: 14px; }
.ep-card {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--card-2); transition: .15s;
}
.ep-card:hover { border-color: var(--border-strong); background: var(--hover); }
.ep-card.is-on { border-left: 2px solid var(--success); }
.ep-card:not(.is-on) { border-left: 2px solid var(--danger); opacity: .78; }
.ep-card__main { min-width: 0; flex: 1; }
.ep-card__line { display: flex; align-items: center; gap: 7px; min-width: 0; }
.ep-card__path {
  font-family: var(--mono); font-size: 11.5px; color: var(--fg-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr;
}
.ep-card__desc { font-size: 11.5px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.ep-card__tags { display: flex; gap: 5px; margin-top: 7px; flex-wrap: wrap; }
.ep-tag {
  font-size: 10px; padding: 1px 6px; border-radius: 4px; background: var(--hover);
  color: var(--muted); border: 1px solid var(--border);
}
.ep-tag--public { color: var(--success); background: var(--success-soft); border-color: transparent; }
.ep-tag--proto { font-family: var(--mono); }
.ep-card__side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; }
.ep-state { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--faint); white-space: nowrap; }
.ep-state--on { color: var(--success); }
.ep-copy { width: 22px; height: 22px; }
.ep-copy svg { width: 12px; height: 12px; }

.api-migrated { margin-top: 4px; }
.api-migrated__inner { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.api-migrated__icon {
  width: 40px; height: 40px; flex: none; border-radius: 10px; display: inline-flex;
  align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary);
}
.api-migrated__icon svg { width: 20px; height: 20px; }
.api-migrated__text { flex: 1; min-width: 200px; }
.api-migrated__text h3 { font-size: 13px; font-weight: 600; color: var(--fg); margin: 0 0 4px; }
.api-migrated__text p { font-size: 11.5px; color: var(--muted); margin: 0; line-height: 1.6; }

@media (max-width: 900px) {
  .ep-grid { grid-template-columns: minmax(0, 1fr); }
  .api-group__bar { width: 70px; }
  .api-group__items { display: none; }
}
@media (max-width: 560px) {
  .api-group__head { flex-wrap: wrap; }
  .api-group__meta { width: 100%; justify-content: space-between; }
}

/* ==========================================================================
   Feature Billing / 积分扣除模块
   ========================================================================== */
.deduct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; padding: 14px; }
.deduct-card {
  display: flex; flex-direction: column; gap: 10px; padding: 14px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--card); transition: .15s;
}
.deduct-card:hover { border-color: var(--border-strong); box-shadow: 0 4px 18px rgba(0, 0, 0, .08); }
.deduct-card.is-off { opacity: .6; }
.deduct-card__head { display: flex; align-items: center; gap: 10px; }
.deduct-card__icon {
  width: 36px; height: 36px; flex: none; border-radius: 9px; display: inline-flex;
  align-items: center; justify-content: center; font-size: 16px; font-weight: 700;
  background: var(--warning-soft); color: var(--warning);
}
.deduct-card__icon--violet { background: var(--violet-soft); color: var(--violet); }
.deduct-card__icon--green { background: var(--success-soft); color: var(--success); }
.deduct-card__icon--blue { background: var(--primary-soft); color: var(--primary); }
.deduct-card__icon--cyan { background: rgba(56, 189, 248, .12); color: #38bdf8; }
.deduct-card__icon--rose { background: var(--danger-soft); color: var(--danger); }
.deduct-card__title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.deduct-card__title strong { font-size: 13px; font-weight: 600; color: var(--fg); }
.deduct-card__title span { font-size: 10.5px; color: var(--faint); }
.deduct-card__menu { flex: none; }
.deduct-card__desc { font-size: 11.5px; color: var(--muted); line-height: 1.55; min-height: 18px; }
.deduct-card__metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 9px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.deduct-card__metrics > div { display: flex; flex-direction: column; gap: 3px; }
.deduct-card__metrics span { font-size: 10px; color: var(--faint); }
.deduct-card__metrics b { font-size: 13px; color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }
.deduct-card__metrics b.t-green { color: var(--success); }
.deduct-card__params { display: flex; flex-wrap: wrap; gap: 5px; min-height: 20px; }
.deduct-param { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 5px; background: var(--card-2); border: 1px solid var(--border); font-size: 10px; }
.deduct-param code { font-family: var(--mono); color: var(--fg-2); }
.deduct-param i { font-style: normal; color: var(--faint); }
.deduct-param em { font-style: normal; color: var(--danger); font-size: 9px; }
.deduct-card__api { display: flex; align-items: center; gap: 6px; padding: 7px 9px; border-radius: 8px; background: var(--card-2); border: 1px dashed var(--border-strong); min-width: 0; }
.deduct-card__api code { flex: 1; min-width: 0; font-family: var(--mono); font-size: 10.5px; color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; }
.deduct-card__api .icon-action { width: 20px; height: 20px; }
.deduct-card__api .icon-action svg { width: 12px; height: 12px; }
.deduct-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.deduct-card__foot .link-btn { font-size: 11.5px; }

/* 新建/编辑弹窗：API 预览与参数编辑器 */
.deduct-api-preview { display: flex; align-items: center; gap: 7px; margin-top: 12px; padding: 9px 11px; border-radius: 8px; background: var(--card-2); border: 1px solid var(--border); }
.deduct-api-preview code { font-family: var(--mono); font-size: 11.5px; color: var(--fg-2); }
.param-editor { margin-top: 14px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.param-editor__head { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; background: var(--card-2); border-bottom: 1px solid var(--border); font-size: 12px; font-weight: 600; color: var(--fg); }
.param-editor__labels, .param-row {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) 88px minmax(0, 1fr) 62px 30px;
  gap: 8px; align-items: center; padding: 8px 12px;
}
.param-editor__labels { font-size: 10.5px; color: var(--faint); background: var(--card-2); border-bottom: 1px solid var(--border); }
.param-editor__body { max-height: 280px; overflow: auto; }
.param-row { border-bottom: 1px solid var(--border); }
.param-row:last-child { border-bottom: 0; }
.param-row input, .param-row select {
  width: 100%; height: 30px; padding: 0 8px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--card); color: var(--fg); font-size: 11.5px; outline: none;
}
.param-row input:focus, .param-row select:focus { border-color: var(--primary); }
.param-row .check { white-space: nowrap; font-size: 10.5px; gap: 4px; }
.param-row .param-del { width: 26px; height: 26px; }
.param-editor > .field-hint { padding: 8px 12px; margin: 0; border-top: 1px solid var(--border); background: var(--card-2); }
@media (max-width: 860px) {
  .param-editor__labels { display: none; }
  .param-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
