/* ==========================================================================
   SentinelHub 设计系统 v2 —— 企业控制台视觉语言
   --------------------------------------------------------------------------
   Tier 1  原始色板  --sh-c-*   参考 AntD 色板
   Tier 2  语义 Token --sh-*     随 color-scheme 自动切换（light-dark）
   Tier 3  组件 Token --sh-*     间距 / 圆角 / 字号 / 控件高度 / 层级
   组件层  .card .btn .tag table .modal ... 与全部业务页共用同一套实现
   兼容层  --bg --panel --primary ...   历史内联样式继续可用
   主题    默认暗色；<meta name="color-scheme"> 同步 light/dark，light-dark() 自动翻转
   ========================================================================== */

/* ---------------- Tier 1 · 原始色板 ---------------- */
:root {
  --sh-c-blue-1: #e8f3ff; --sh-c-blue-2: #c2dfff; --sh-c-blue-3: #91caff;
  --sh-c-blue-4: #4c9bff; --sh-c-blue-5: #1677ff; --sh-c-blue-6: #0958d9;
  --sh-c-blue-7: #003eb3; --sh-c-blue-8: #002c8c; --sh-c-blue-9: #001d66;

  --sh-c-green-1: #f6ffed; --sh-c-green-2: #d9f7be; --sh-c-green-3: #95de64;
  --sh-c-green-4: #73d13d; --sh-c-green-5: #52c41a; --sh-c-green-6: #389e0d;
  --sh-c-green-7: #237804; --sh-c-green-8: #135200; --sh-c-green-9: #092b00;

  --sh-c-gold-1: #fffbe6; --sh-c-gold-2: #fff1b8; --sh-c-gold-3: #ffe58f;
  --sh-c-gold-4: #ffc53d; --sh-c-gold-5: #faad14; --sh-c-gold-6: #d48806;
  --sh-c-gold-7: #ad6800; --sh-c-gold-8: #874d00; --sh-c-gold-9: #613400;

  --sh-c-red-1: #fff1f0; --sh-c-red-2: #ffccc7; --sh-c-red-3: #ffa39e;
  --sh-c-red-4: #ff4d4f; --sh-c-red-5: #f5222d; --sh-c-red-6: #cf1322;
  --sh-c-red-7: #a8071a; --sh-c-red-8: #820014; --sh-c-red-9: #5c0011;

  --sh-c-gray-0: #ffffff; --sh-c-gray-1: #fafafa; --sh-c-gray-2: #f5f5f5;
  --sh-c-gray-3: #f0f0f0; --sh-c-gray-4: #d9d9d9; --sh-c-gray-5: #bfbfbf;
  --sh-c-gray-6: #8c8c8c; --sh-c-gray-7: #595959; --sh-c-gray-8: #434343;
  --sh-c-gray-9: #262626;
}

/* ---------------- Tier 2 · 语义 Token ---------------- */
:root {
  color-scheme: light dark;
  scrollbar-gutter: stable;
  --sh-font: "Segoe UI Variable", "Microsoft YaHei UI", "Noto Sans SC", "PingFang SC", system-ui, sans-serif;
  --sh-font-mono: "Cascadia Code", Consolas, "SF Mono", "JetBrains Mono", monospace;

  /* 背景层次：底板 → 卡片 → 次级面 → 悬浮面 */
  --sh-bg:             light-dark(#f2f4f8, #0e1116);
  --sh-surface:        light-dark(#ffffff, #161a21);
  --sh-surface-subtle: light-dark(#f7f9fc, #1b202a);
  --sh-surface-hover:  light-dark(#eef2f7, #222935);
  --sh-surface-sunken: light-dark(#eaeef4, #0a0d12);

  /* 描边与分隔 */
  --sh-border:        light-dark(#e1e6ee, #29313c);
  --sh-border-strong: light-dark(#c3ccd9, #3d4754);
  --sh-divider:       light-dark(#edf0f5, #1f252e);

  /* 文本 */
  --sh-text:            light-dark(#17202b, #edf0f5);
  --sh-text-secondary:  light-dark(#5a6675, #a6aebc);
  --sh-text-tertiary:   light-dark(#6d7887, #87909f);
  --sh-text-placeholder: light-dark(#7a8595, #8b94a4);
  --sh-text-disabled:   light-dark(#b0b8c4, #59616e);

  /* 品牌色：primary 用于描边/图标，primary-text 用于正文链接，primary-solid 用于实心按钮 */
  --sh-primary:        light-dark(#1677ff, #5aa2ff);
  --sh-primary-text:   light-dark(#0958d9, #7ab4ff);
  --sh-primary-solid:  light-dark(#1d5fd0, #2563eb);
  --sh-primary-hover:  light-dark(#184fae, #1d4ed8);
  --sh-primary-active: light-dark(#123f8c, #1e40af);
  --sh-primary-soft:   light-dark(rgba(22, 119, 255, .09), rgba(90, 162, 255, .13));
  --sh-primary-border: light-dark(rgba(22, 119, 255, .32), rgba(90, 162, 255, .34));
  --sh-accent-gradient: linear-gradient(135deg, #4c9bff 0%, #2f7ce5 55%, #1d5fd0 100%);

  /* 功能色 */
  --sh-success:        light-dark(#2f8a12, #6fd98b);
  --sh-success-solid:  light-dark(#31870f, #2f8a12);
  --sh-success-soft:   light-dark(rgba(56, 158, 13, .10), rgba(111, 217, 139, .14));
  --sh-warning:        light-dark(#a8690a, #f0c05a);
  --sh-warning-solid:  light-dark(#c98a0b, #d9a521);
  --sh-warning-soft:   light-dark(rgba(250, 173, 20, .13), rgba(240, 192, 90, .14));
  --sh-error:          light-dark(#c22b2b, #ff8f8b);
  --sh-error-solid:    light-dark(#c22b2b, #c93b36);
  --sh-error-soft:     light-dark(rgba(207, 19, 34, .08), rgba(255, 143, 139, .13));
  --sh-info:           var(--sh-primary-text);
  --sh-info-soft:      var(--sh-primary-soft);

  /* 阴影与遮罩 */
  --sh-shadow-1: light-dark(0 1px 2px rgba(16, 24, 40, .06), 0 1px 2px rgba(0, 0, 0, .32));
  --sh-shadow-2: light-dark(0 6px 18px -6px rgba(16, 24, 40, .16), 0 8px 22px -8px rgba(0, 0, 0, .55));
  --sh-shadow-3: light-dark(0 24px 48px -16px rgba(16, 24, 40, .24), 0 28px 56px -16px rgba(0, 0, 0, .78));
  --sh-overlay:  light-dark(rgba(15, 23, 42, .42), rgba(4, 7, 12, .68));

  /* 顶栏与导航 */
  --sh-topbar:      light-dark(rgba(255, 255, 255, .88), rgba(12, 15, 20, .86));
  --sh-nav:         light-dark(#fbfcfe, #12161c);
  --sh-topbar-text: light-dark(#17202b, rgba(255, 255, 255, .9));

  /* 焦点环 */
  --sh-focus: var(--sh-primary);
  --sh-ring: 0 0 0 3px color-mix(in srgb, var(--sh-primary) 22%, transparent);
}

/* 手动切换：meta 的 content 为 light / dark，CSS 依据它翻转 color-scheme */
:root:has(> head > meta[name="color-scheme"][content="dark"]) { color-scheme: dark; }
:root:has(> head > meta[name="color-scheme"][content="light"]) { color-scheme: light; }

/* 不支持 light-dark() 的浏览器回退到显式两套色值 */
@supports not (color: light-dark(#000, #fff)) {
  :root {
    --sh-bg: #0e1116; --sh-surface: #161a21; --sh-surface-subtle: #1b202a;
    --sh-surface-hover: #222935; --sh-surface-sunken: #0a0d12;
    --sh-border: #29313c; --sh-border-strong: #3d4754; --sh-divider: #1f252e;
    --sh-text: #edf0f5; --sh-text-secondary: #a6aebc;
    --sh-text-tertiary: #87909f; --sh-text-placeholder: #8b94a4; --sh-text-disabled: #59616e;
    --sh-primary: #5aa2ff; --sh-primary-text: #7ab4ff; --sh-primary-solid: #2563eb;
    --sh-primary-hover: #1d4ed8; --sh-primary-active: #1e40af;
    --sh-primary-soft: rgba(90, 162, 255, .13); --sh-primary-border: rgba(90, 162, 255, .34);
    --sh-shadow-1: 0 1px 2px rgba(0, 0, 0, .32);
    --sh-shadow-2: 0 8px 22px -8px rgba(0, 0, 0, .55);
    --sh-shadow-3: 0 28px 56px -16px rgba(0, 0, 0, .78);
    --sh-success: #6fd98b; --sh-success-solid: #2f8a12; --sh-success-soft: rgba(111, 217, 139, .14);
    --sh-warning: #f0c05a; --sh-warning-solid: #d9a521; --sh-warning-soft: rgba(240, 192, 90, .14);
    --sh-error: #ff8f8b; --sh-error-solid: #c93b36; --sh-error-soft: rgba(255, 143, 139, .13);
    --sh-topbar: rgba(12, 15, 20, .86); --sh-nav: #12161c;
  }
  :root:has(> head > meta[name="color-scheme"][content="light"]) {
    --sh-bg: #f2f4f8; --sh-surface: #fff; --sh-surface-subtle: #f7f9fc;
    --sh-surface-hover: #eef2f7; --sh-surface-sunken: #eaeef4;
    --sh-border: #e1e6ee; --sh-border-strong: #c3ccd9; --sh-divider: #edf0f5;
    --sh-text: #17202b; --sh-text-secondary: #5a6675;
    --sh-text-tertiary: #6d7887; --sh-text-placeholder: #7a8595; --sh-text-disabled: #b0b8c4;
    --sh-primary: #1677ff; --sh-primary-text: #0958d9; --sh-primary-solid: #1d5fd0;
    --sh-primary-hover: #184fae; --sh-primary-active: #123f8c;
    --sh-primary-soft: rgba(22, 119, 255, .09); --sh-primary-border: rgba(22, 119, 255, .32);
    --sh-success: #2f8a12; --sh-success-solid: #31870f; --sh-success-soft: rgba(56, 158, 13, .10);
    --sh-warning: #a8690a; --sh-warning-solid: #c98a0b; --sh-warning-soft: rgba(250, 173, 20, .13);
    --sh-error: #c22b2b; --sh-error-solid: #c22b2b; --sh-error-soft: rgba(207, 19, 34, .08);
    --sh-topbar: rgba(255, 255, 255, .88); --sh-nav: #fbfcfe;
  }
}

/* ---------------- Tier 3 · 组件 Token ---------------- */
:root {
  --sh-radius-sm:  4px;
  --sh-radius:     6px;
  --sh-radius-lg:  8px;
  --sh-radius-pill: 999px;

  --sh-space-1: 4px;  --sh-space-2: 8px;  --sh-space-3: 12px;
  --sh-space-4: 16px; --sh-space-5: 20px; --sh-space-6: 24px;
  --sh-space-7: 32px; --sh-space-8: 40px;

  --sh-font-size-xs: 12px;
  --sh-font-size-sm: 13px;
  --sh-font-size:    14px;
  --sh-font-size-lg: 16px;
  --sh-font-size-xl: 20px;
  --sh-line-height: 1.5714;

  --sh-control-height:    32px;
  --sh-control-height-sm: 26px;
  --sh-control-height-lg: 40px;

  --sh-appbar-h:  52px;
  --sh-sidebar-w: 248px;

  --sh-z-modal:  1000;
  --sh-z-mask:   480;
  --sh-z-sidebar: 490;
  --sh-z-appbar:  500;
}

/* ---------------- 兼容层 ---------------- */
:root {
  --bg:          var(--sh-bg);
  --surface:     var(--sh-surface);
  --surface2:    var(--sh-surface-subtle);
  --panel:       var(--sh-surface);
  --border:      var(--sh-border);
  --primary:     var(--sh-primary);
  --primary-dark: var(--sh-primary-hover);
  --success:     var(--sh-success);
  --warning:     var(--sh-warning);
  --error:       var(--sh-error);
  --text:        var(--sh-text);
  --muted:       var(--sh-text-secondary);
  --radius:      var(--sh-radius);
}

/* ==================== 基础重置 ==================== */
*, *::before, *::after { box-sizing: border-box; }
html {
  background: var(--sh-bg);
  color-scheme: inherit;
  scroll-padding-top: calc(var(--sh-appbar-h) + 16px);
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--sh-bg);
  color: var(--sh-text);
  font-family: var(--sh-font);
  font-size: var(--sh-font-size);
  line-height: var(--sh-line-height);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, p, figure { margin: 0; }
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -.01em; }
ul { margin: 0; padding: 0; list-style: none; }
ol { margin: 0; }
a { color: var(--sh-primary-text); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--sh-primary-hover); }
img { max-width: 100%; }
code, pre, .mono, kbd { font-family: var(--sh-font-mono); }
b, strong { font-weight: 600; }
hr { border: 0; border-block-start: 1px solid var(--sh-border); margin: var(--sh-space-4) 0; }

:root {
  accent-color: var(--sh-primary);
  scrollbar-color: light-dark(#c3ccd9, #3d4754) transparent;
}

/* 细滚动条，避免表格滚动条挤压内容 */
* { scrollbar-width: thin; }
::-webkit-scrollbar { inline-size: 10px; block-size: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--sh-text-tertiary) 32%, transparent);
  border: 2px solid transparent;
  border-radius: var(--sh-radius-pill);
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--sh-text-tertiary) 55%, transparent); background-clip: padding-box; }

::selection { background: color-mix(in srgb, var(--sh-primary) 26%, transparent); }

/* ==================== 表单控件 ==================== */
button, input, select, textarea { font: inherit; }
input, select, textarea { color: inherit; }
button { border-radius: var(--sh-radius-sm); }
button:disabled, input:disabled, select:disabled, textarea:disabled {
  cursor: not-allowed;
  opacity: .55;
}
input, select, textarea {
  min-block-size: var(--sh-control-height);
  min-inline-size: 0;
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius-sm);
  background: var(--sh-surface-subtle);
  color: var(--sh-text);
  padding: 4px 11px;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
:root:has(> head > meta[name="color-scheme"][content="light"]) input,
:root:has(> head > meta[name="color-scheme"][content="light"]) select,
:root:has(> head > meta[name="color-scheme"][content="light"]) textarea { background: var(--sh-surface); }
textarea { min-height: 76px; resize: vertical; line-height: var(--sh-line-height); }
input::placeholder, textarea::placeholder { color: var(--sh-text-placeholder); }
input:hover, select:hover, textarea:hover { border-color: var(--sh-border-strong); }
input:focus, select:focus, textarea:focus {
  border-color: var(--sh-primary);
  outline: none;
  box-shadow: var(--sh-ring);
}
input:not(input[type="range"]):user-invalid, textarea:user-invalid { border-color: var(--sh-error); }
input[type="checkbox"], input[type="radio"] {
  min-block-size: auto;
  min-inline-size: auto;
  inline-size: 16px;
  block-size: 16px;
  padding: 0;
  accent-color: var(--sh-primary);
}
input[type="file"] { padding: 4px 8px; }
input[type="file"]::file-selector-button {
  margin-inline-end: 8px;
  padding: 4px 12px;
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius-sm);
  background: var(--sh-surface);
  color: var(--sh-text);
  cursor: pointer;
}
input[type="file"]::file-selector-button:hover {
  border-color: var(--sh-primary);
  color: var(--sh-primary-text);
}
:focus-visible { outline: 2px solid var(--sh-focus); outline-offset: 2px; }

.sr-only {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
[hidden] { display: none !important; }

/* ==================== 页面骨架 ==================== */
.page-head {
  display: flex;
  align-items: center;
  gap: var(--sh-space-3);
  margin-bottom: var(--sh-space-4);
  flex-wrap: wrap;
}
.page-head h1 {
  font-size: var(--sh-font-size-xl);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -.02em;
  color: var(--sh-text);
}
.page-head .subtitle, .page-head .desc {
  color: var(--sh-text-secondary);
  font-size: var(--sh-font-size-sm);
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--sh-text-secondary);
  font-size: var(--sh-font-size-sm);
  text-decoration: none;
  margin-inline-start: auto;
  padding: 4px 8px;
  border-radius: var(--sh-radius-sm);
  transition: color .15s ease, background-color .15s ease;
}
.back-link:hover { color: var(--sh-primary-text); background: var(--sh-surface-hover); }

/* ==================== 卡片 ==================== */
.card {
  background: var(--sh-surface);
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius-lg);
  box-shadow: var(--sh-shadow-1);
  padding: var(--sh-space-4);
  margin-bottom: var(--sh-space-4);
}
.card h2, .card-title {
  display: flex;
  align-items: center;
  gap: var(--sh-space-2);
  font-size: var(--sh-font-size);
  font-weight: 600;
  color: var(--sh-text);
  margin: 0 0 var(--sh-space-3);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sh-space-3);
  flex-wrap: wrap;
  margin-bottom: var(--sh-space-3);
}
.card-head .card-title { margin: 0; }
.card h2::before, .card-title::before {
  content: '';
  inline-size: 3px;
  block-size: 15px;
  background: var(--sh-primary);
  border-radius: 2px;
  flex: 0 0 auto;
}
.card .desc, .desc, .muted {
  color: var(--sh-text-secondary);
  font-size: var(--sh-font-size-sm);
  line-height: 1.7;
}
.desc b, .card .desc b { color: var(--sh-text); font-weight: 600; }
.hint { color: var(--sh-text-tertiary); font-size: var(--sh-font-size-xs); line-height: 1.6; }
.empty {
  color: var(--sh-text-tertiary);
  font-size: var(--sh-font-size-sm);
  padding: var(--sh-space-6) 0;
  text-align: center;
}
.footer, .auth-footer {
  color: var(--sh-text-tertiary);
  font-size: var(--sh-font-size-xs);
  text-align: center;
  padding: var(--sh-space-4) 0 var(--sh-space-2);
}
.mono { font-family: var(--sh-font-mono); }

/* ==================== 表单 ==================== */
.form-row {
  display: flex;
  gap: var(--sh-space-3);
  flex-wrap: wrap;
  align-items: flex-end;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--sh-space-3);
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sh-space-1);
  min-inline-size: 0;
}
.form-group label {
  font-size: var(--sh-font-size-xs);
  color: var(--sh-text-secondary);
  font-weight: 500;
  line-height: 1.5;
}
.form-group .hint { margin-top: 2px; }
.form-row > button { flex: 0 0 auto; }

/* ==================== 按钮 ==================== */
/* 裸 button 基线：主操作实心按钮。小圆角、扁平、字重更明确 */
:where(button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sh-space-1);
  min-block-size: var(--sh-control-height);
  padding: 0 14px;
  border: 1px solid var(--sh-primary-solid);
  background-color: var(--sh-primary-solid);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .10), rgba(255, 255, 255, 0) 62%);
  color: #fff;
  border-radius: var(--sh-radius-sm);
  font-size: var(--sh-font-size-sm);
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .10);
  transition: background-color .14s ease, border-color .14s ease, color .14s ease, box-shadow .14s ease, translate .14s ease;
}
:where(button:hover:not(:disabled)) {
  background-color: var(--sh-primary-hover);
  border-color: var(--sh-primary-hover);
  color: #fff;
}
:where(button:active:not(:disabled)) {
  background-color: var(--sh-primary-active);
  border-color: var(--sh-primary-active);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .22);
  translate: 0 1px;
}

.btn, button.ghost, button.warn, button.danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sh-space-1);
  min-block-size: var(--sh-control-height);
  padding: 0 13px;
  border: 1px solid var(--sh-border);
  background-color: var(--sh-surface);
  background-image: none;
  color: var(--sh-text);
  border-radius: var(--sh-radius-sm);
  font-size: var(--sh-font-size-sm);
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: none;
  transition: background-color .14s ease, border-color .14s ease, color .14s ease, box-shadow .14s ease;
}
.btn:hover:not(:disabled), button.ghost:hover:not(:disabled) {
  background-color: var(--sh-surface-hover);
  border-color: var(--sh-border-strong);
  color: var(--sh-primary-text);
}
.btn:active:not(:disabled), button.ghost:active:not(:disabled) { background-color: var(--sh-surface-sunken); }
.btn-primary, .btn.primary {
  background-color: var(--sh-primary-solid);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .10), rgba(255, 255, 255, 0) 62%);
  border-color: var(--sh-primary-solid);
  color: #fff;
  font-weight: 600;
  letter-spacing: .02em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .10);
}
.btn-primary:hover:not(:disabled), .btn.primary:hover:not(:disabled) {
  background-color: var(--sh-primary-hover);
  border-color: var(--sh-primary-hover);
  color: #fff;
}
.btn-primary:active:not(:disabled), .btn.primary:active:not(:disabled) {
  background-color: var(--sh-primary-active);
  border-color: var(--sh-primary-active);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .22);
  translate: 0 1px;
}
button.ok-btn {
  background-color: var(--sh-success-solid);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .10), rgba(255, 255, 255, 0) 62%);
  border-color: var(--sh-success-solid);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .10);
}
button.ok-btn:hover:not(:disabled) {
  background-color: color-mix(in srgb, var(--sh-success-solid) 88%, #000);
}
.btn-danger, .btn.danger, button.danger {
  background-color: transparent;
  background-image: none;
  color: var(--sh-error);
  border-color: color-mix(in srgb, var(--sh-error) 42%, var(--sh-border));
}
.btn-danger:hover:not(:disabled), .btn.danger:hover:not(:disabled), button.danger:hover:not(:disabled) {
  background-color: var(--sh-error-soft);
  border-color: var(--sh-error);
}
.btn-ghost, .btn.ghost, button.ghost {
  background-color: transparent;
  background-image: none;
  color: var(--sh-text-secondary);
}
.btn-ghost:hover:not(:disabled), .btn.ghost:hover:not(:disabled), button.ghost:hover:not(:disabled) {
  background-color: var(--sh-surface-hover);
  border-color: var(--sh-border-strong);
  color: var(--sh-primary-text);
}
.btn.warn, button.warn {
  background-color: transparent;
  background-image: none;
  color: var(--sh-warning);
  border-color: color-mix(in srgb, var(--sh-warning) 50%, var(--sh-border));
}
.btn.warn:hover:not(:disabled), button.warn:hover:not(:disabled) {
  background-color: var(--sh-warning-soft);
  border-color: var(--sh-warning);
}
/* 文字按钮：覆盖 button.warn / button.danger 的描边样式，保持轻量 */
button.btn-link, .btn-link, .link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-block-size: auto;
  background: transparent;
  background-image: none;
  border: 1px solid transparent;
  color: var(--sh-primary-text);
  padding: 2px 6px;
  font-size: var(--sh-font-size-xs);
  font-weight: 500;
  border-radius: 3px;
  box-shadow: none;
  cursor: pointer;
  white-space: nowrap;
}
button.btn-link:hover:not(:disabled), .btn-link:hover:not(:disabled) {
  background: var(--sh-primary-soft);
  border-color: transparent;
  color: var(--sh-primary-text);
  text-decoration: none;
}
button.btn-link.warn, .btn-link.warn {
  background: transparent;
  background-image: none;
  border-color: transparent;
  color: var(--sh-warning);
}
button.btn-link.warn:hover:not(:disabled), .btn-link.warn:hover:not(:disabled) {
  background: var(--sh-warning-soft);
  color: var(--sh-warning);
}
button.btn-link.danger, .btn-link.danger {
  background: transparent;
  background-image: none;
  border-color: transparent;
  color: var(--sh-error);
}
button.btn-link.danger:hover:not(:disabled), .btn-link.danger:hover:not(:disabled) {
  background: var(--sh-error-soft);
  color: var(--sh-error);
}
.btn-sm { min-block-size: var(--sh-control-height-sm); padding: 0 10px; font-size: var(--sh-font-size-xs); }

/* ==================== 状态标签 ==================== */
.tag, .badge, .badge-adv, .role-tag, .pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-block-size: 21px;
  padding: 0 7px;
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius-sm);
  background: var(--sh-surface-subtle);
  color: var(--sh-text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.tag.on, .badge-active, .badge-success, .badge.pass, .tag.tls-on, .tag.udp, .tag.ok, .pill.done {
  color: var(--sh-success);
  background: var(--sh-success-soft);
  border-color: color-mix(in srgb, var(--sh-success) 32%, var(--sh-border));
}
.badge-warn, .badge-warning, .badge-advanced, .badge-adv, .badge.review, .tag.observe, .pill.wait {
  color: var(--sh-warning);
  background: var(--sh-warning-soft);
  border-color: color-mix(in srgb, var(--sh-warning) 34%, var(--sh-border));
}
.badge-disabled, .badge-error, .badge.reject, .tag.fail, .tag.enforce, .pill.ft-bug {
  color: var(--sh-error);
  background: var(--sh-error-soft);
  border-color: color-mix(in srgb, var(--sh-error) 32%, var(--sh-border));
}
.badge-admin, .tag.tcp, .pill.ft-feature {
  color: var(--sh-primary-text);
  background: var(--sh-primary-soft);
  border-color: var(--sh-primary-border);
}
.badge-user, .badge-muted, .pill.ft-other, .tag.tls-off {
  color: var(--sh-text-secondary);
  background: var(--sh-surface-subtle);
}

/* ==================== 状态条 ==================== */
.status-bar {
  display: flex;
  gap: var(--sh-space-4);
  flex-wrap: wrap;
  align-items: center;
  font-size: var(--sh-font-size-sm);
  color: var(--sh-text-secondary);
}
.status-item { display: inline-flex; align-items: center; gap: 6px; color: var(--sh-text); }
.dot {
  inline-size: 8px;
  block-size: 8px;
  border-radius: 50%;
  background: var(--sh-text-tertiary);
  flex: 0 0 auto;
  box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 12%, transparent);
}
.dot.ok { background: var(--sh-success); color: var(--sh-success); }
.dot.bad { background: var(--sh-error); color: var(--sh-error); }
.dot.pv { background: var(--sh-warning); color: var(--sh-warning); }

/* ==================== 反馈条 ==================== */
.msg-box, .alert {
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  background: var(--sh-surface-subtle);
  color: var(--sh-text);
  font-size: var(--sh-font-size-sm);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg-box {
  display: none;
  margin-top: var(--sh-space-3);
  padding: 10px 14px;
}
.msg-box.ok, .msg-box.err, .msg-box.warn { display: block; }
.msg-box.ok, .alert.success {
  background: var(--sh-success-soft);
  border-color: color-mix(in srgb, var(--sh-success) 32%, var(--sh-border));
  color: var(--sh-success);
}
.msg-box.warn, .alert.warn {
  background: var(--sh-warning-soft);
  border-color: color-mix(in srgb, var(--sh-warning) 34%, var(--sh-border));
  color: var(--sh-warning);
}
.msg-box.err, .alert {
  background: var(--sh-error-soft);
  border-color: color-mix(in srgb, var(--sh-error) 32%, var(--sh-border));
  color: var(--sh-error);
}
.alert {
  display: none;
  padding: 8px 12px;
  margin-bottom: var(--sh-space-3);
}
.alert.show { display: block; }
.alert.info {
  background: var(--sh-info-soft);
  border-color: var(--sh-primary-border);
  color: var(--sh-primary-text);
}

/* ==================== 表格 ==================== */
.table-wrap {
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  overflow: auto;
  max-inline-size: 100%;
  background: var(--sh-surface);
}
table {
  inline-size: 100%;
  min-inline-size: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--sh-font-size-sm);
  color: var(--sh-text);
}
caption { text-align: start; padding: var(--sh-space-2) var(--sh-space-3); color: var(--sh-text-secondary); font-size: var(--sh-font-size-xs); }
th {
  position: sticky;
  inset-block-start: 0;
  z-index: 1;
  background: var(--sh-surface-subtle);
  color: var(--sh-text-secondary);
  font-weight: 600;
  font-size: var(--sh-font-size-xs);
  text-align: start;
  padding: 10px 12px;
  border-bottom: 1px solid var(--sh-border);
  white-space: nowrap;
}
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--sh-divider);
  vertical-align: middle;
  line-height: 1.55;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background-color .12s ease; }
tbody tr:hover td { background: color-mix(in srgb, var(--sh-primary) 4%, transparent); }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; }
.op-cell { white-space: nowrap; }

/* ==================== 分页 ==================== */
.pagination, .pager {
  display: flex;
  align-items: center;
  gap: var(--sh-space-1);
  flex-wrap: wrap;
  margin-top: var(--sh-space-3);
  color: var(--sh-text-secondary);
  font-size: var(--sh-font-size-sm);
}
.pagination button, .pager button {
  min-block-size: var(--sh-control-height-sm);
  min-inline-size: var(--sh-control-height-sm);
  padding: 2px 10px;
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius-sm);
  background: var(--sh-surface);
  color: var(--sh-text);
  cursor: pointer;
  font-size: var(--sh-font-size-xs);
}
.pagination button:hover:not(:disabled), .pager button:hover:not(:disabled) {
  border-color: var(--sh-primary);
  color: var(--sh-primary-text);
}
.pagination button.active, .pager button.active {
  background: var(--sh-primary-solid);
  border-color: var(--sh-primary-solid);
  color: #fff;
}
.pagination button:disabled, .pager button:disabled { opacity: .4; cursor: not-allowed; }

/* ==================== 弹层 ==================== */
.modal-overlay, .modal-mask {
  position: fixed;
  inset: 0;
  z-index: var(--sh-z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sh-space-4);
  background: var(--sh-overlay);
  backdrop-filter: blur(3px);
}
.modal-overlay { display: none; }
.modal-overlay.show { display: flex; }
.modal {
  inline-size: min(var(--sh-modal-width, 520px), 100%);
  max-block-size: 86vh;
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--sh-surface);
  color: var(--sh-text);
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius-lg);
  box-shadow: var(--sh-shadow-3);
  padding: var(--sh-space-5);
}
.modal h3 { font-size: var(--sh-font-size-lg); font-weight: 600; margin: 0 0 var(--sh-space-2); }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sh-space-2);
  margin-top: var(--sh-space-5);
}
.modal-close {
  inline-size: 28px;
  block-size: 28px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: var(--sh-radius-sm);
  background: transparent;
  color: var(--sh-text-secondary);
  font-size: 18px;
  cursor: pointer;
}
.modal-close:hover { background: var(--sh-surface-hover); color: var(--sh-text); }

/* ==================== 开关 ==================== */
.switch { position: relative; display: inline-block; inline-size: 36px; block-size: 20px; cursor: pointer; }
.switch input {
  position: absolute;
  inset: 0;
  display: block;
  inline-size: 100%;
  block-size: 100%;
  opacity: 0;
  margin: 0;
  padding: 0;
  border: 0;
  cursor: pointer;
}
.switch span {
  position: absolute;
  inset: 0;
  border-radius: var(--sh-radius-pill);
  background: var(--sh-border-strong);
  transition: background-color .2s ease;
  pointer-events: none;
}
.switch span::after {
  content: '';
  position: absolute;
  inline-size: 16px;
  block-size: 16px;
  inset-block-start: 2px;
  inset-inline-start: 2px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  transition: translate .2s ease;
}
.switch input:checked + span { background: var(--sh-success); }
.switch input:checked + span::after { translate: 16px 0; }
.switch input:focus-visible + span { outline: 2px solid var(--sh-focus); outline-offset: 2px; }

/* ==================== 页签 ==================== */
.tab-nav, .tabs, .view-tabs {
  display: flex;
  gap: var(--sh-space-1);
  margin-bottom: var(--sh-space-4);
  border-bottom: 1px solid var(--sh-border);
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-nav::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  background: transparent;
  border: none;
  color: var(--sh-text-secondary);
  padding: 10px 16px;
  font-size: var(--sh-font-size);
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.tab-btn:hover { color: var(--sh-primary-text); background: var(--sh-surface-hover); }
.tab-btn.active {
  color: var(--sh-primary-text);
  font-weight: 600;
  border-bottom-color: var(--sh-primary);
  background: transparent;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ==================== 端点 / 代码展示 ==================== */
.endpoint-bar, .url-bar {
  display: flex;
  align-items: center;
  gap: var(--sh-space-3);
  background: var(--sh-surface-sunken);
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  padding: var(--sh-space-2) var(--sh-space-3);
  margin-bottom: var(--sh-space-3);
  flex-wrap: wrap;
}
.endpoint-label, .url-bar span {
  font-size: var(--sh-font-size-xs);
  color: var(--sh-text-secondary);
  white-space: nowrap;
  font-weight: 500;
}
.endpoint-bar code, .url-bar code {
  font-family: var(--sh-font-mono);
  font-size: var(--sh-font-size-sm);
  color: var(--sh-primary-text);
  word-break: break-all;
  user-select: all;
  cursor: pointer;
}
.detail-box {
  background: var(--sh-surface-sunken);
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius);
  padding: var(--sh-space-3);
  font-family: var(--sh-font-mono);
  font-size: var(--sh-font-size-xs);
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  max-block-size: 320px;
  overflow: auto;
  margin: 0;
}
.cell-mono, .mono-cell {
  font-family: var(--sh-font-mono);
  font-size: var(--sh-font-size-xs);
  word-break: break-all;
}
.cell-sum { font-variant-numeric: tabular-nums; text-align: end; }
.row-actions { display: flex; gap: var(--sh-space-1); flex-wrap: wrap; align-items: center; }
.toolbar {
  display: flex;
  gap: var(--sh-space-3);
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: var(--sh-space-3);
}
.toolbar .grow { flex: 1 1 200px; }
.count { color: var(--sh-text-tertiary); font-size: var(--sh-font-size-xs); }

/* ==================== 进度 ==================== */
.progress-track, .diskbar .track {
  block-size: 6px;
  border-radius: var(--sh-radius-pill);
  background: var(--sh-surface-sunken);
  overflow: hidden;
}
.progress-fill, .diskbar .fill {
  block-size: 100%;
  border-radius: var(--sh-radius-pill);
  background: var(--sh-primary);
  transition: inline-size .2s ease;
}
.progress-fill.warn { background: var(--sh-warning); }
.progress-fill.bad { background: var(--sh-error); }

/* ==================== 应用壳层：顶栏 + 侧边导航 ==================== */
.sh-appbar {
  position: fixed;
  inset-block-start: 0; inset-inline: 0;
  block-size: var(--sh-appbar-h);
  display: flex;
  align-items: center;
  gap: var(--sh-space-1);
  padding-inline: var(--sh-space-3);
  background: var(--sh-topbar);
  color: var(--sh-topbar-text);
  border-block-end: 1px solid var(--sh-border);
  backdrop-filter: blur(12px) saturate(1.4);
  z-index: var(--sh-z-appbar);
  min-inline-size: 0;
}
.sh-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-inline: 6px 12px;
  color: var(--sh-topbar-text);
  font-weight: 600;
  font-size: var(--sh-font-size);
  letter-spacing: -.01em;
  white-space: nowrap;
  flex: 0 0 auto;
}
.sh-brand-mark {
  inline-size: 27px; block-size: 27px;
  border-radius: 6px;
  background: var(--sh-accent-gradient);
  display: grid;
  place-items: center;
  color: #fff;
  flex: 0 0 auto;
  box-shadow: 0 3px 10px -2px rgba(37, 99, 235, .55), inset 0 1px 0 rgba(255, 255, 255, .28);
}
.sh-brand-mark svg { inline-size: 17px; block-size: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sh-product {
  font-size: var(--sh-font-size-xs);
  font-weight: 400;
  color: color-mix(in srgb, var(--sh-topbar-text) 58%, transparent);
  border-inline-start: 1px solid color-mix(in srgb, var(--sh-topbar-text) 18%, transparent);
  padding-inline-start: 10px;
  white-space: nowrap;
}
.sh-spacer { flex: 1 1 0; min-inline-size: 0; }
.sh-iconbtn {
  inline-size: 34px; block-size: 34px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: var(--sh-radius-sm);
  background: transparent;
  color: var(--sh-topbar-text);
  cursor: pointer;
  flex: 0 0 auto;
  transition: background-color .15s ease, color .15s ease;
}
.sh-iconbtn:hover { background: color-mix(in srgb, var(--sh-topbar-text) 10%, transparent); color: var(--sh-topbar-text); }
.sh-iconbtn svg { inline-size: 17px; block-size: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sh-user {
  display: flex;
  align-items: center;
  gap: var(--sh-space-2);
  padding-inline: var(--sh-space-1) var(--sh-space-2);
  font-size: var(--sh-font-size-sm);
  color: var(--sh-topbar-text);
  white-space: nowrap;
  flex: 0 0 auto;
}
.sh-user .sh-uname { font-weight: 500; }
.sh-user .sh-role {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--sh-radius-sm);
  color: var(--sh-primary-text);
  background: var(--sh-primary-soft);
  border: 1px solid var(--sh-primary-border);
}
.sh-user .sh-act {
  border: 1px solid color-mix(in srgb, var(--sh-topbar-text) 22%, transparent);
  background: transparent;
  color: color-mix(in srgb, var(--sh-topbar-text) 86%, transparent);
  font-size: var(--sh-font-size-xs);
  min-block-size: 26px;
  padding: 2px 10px;
  border-radius: var(--sh-radius-sm);
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.sh-user .sh-act:hover { background: color-mix(in srgb, var(--sh-topbar-text) 10%, transparent); color: var(--sh-topbar-text); }
.sh-user .sh-act.danger:hover { background: var(--sh-error-soft); border-color: var(--sh-error); color: var(--sh-error); }

.sh-sidebar {
  position: fixed;
  inset-block: var(--sh-appbar-h) 0; inset-inline-start: 0;
  inline-size: var(--sh-sidebar-w);
  background: var(--sh-nav);
  border-inline-end: 1px solid var(--sh-border);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: var(--sh-z-sidebar);
  padding: 10px 10px 16px;
  transition: inline-size .18s ease, translate .18s ease;
}
.sh-nav-group {
  margin: var(--sh-space-4) 10px var(--sh-space-1);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  color: var(--sh-text-tertiary);
  white-space: nowrap;
}
.sh-nav-group:first-child { margin-block-start: 4px; }
.sh-sidebar [hidden] { display: none !important; }
.sh-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-block: 2px;
  padding: 8px 10px;
  border-radius: var(--sh-radius-sm);
  color: var(--sh-text-secondary);
  font-size: var(--sh-font-size-sm);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .15s ease, color .15s ease;
}
.sh-nav-item:hover { background: var(--sh-surface-hover); color: var(--sh-text); }
.sh-nav-item.active {
  background: linear-gradient(90deg, color-mix(in srgb, var(--sh-primary) 16%, transparent), color-mix(in srgb, var(--sh-primary) 5%, transparent));
  color: var(--sh-primary-text);
  font-weight: 600;
}
.sh-nav-item.active::before {
  content: '';
  position: absolute;
  inset-block: 7px;
  inset-inline-start: -10px;
  inline-size: 3px;
  border-radius: 0 1px 1px 0;
  background: var(--sh-primary);
}
.sh-nav-item:focus-visible { outline-offset: -2px; }
.sh-nav-item svg { inline-size: 17px; block-size: 17px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sh-nav-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.sh-nav-label { overflow: hidden; text-overflow: ellipsis; }
.sh-nav-footer {
  margin-block-start: var(--sh-space-3);
  padding: 12px 10px 0;
  border-block-start: 1px solid var(--sh-border);
  font-size: 11px;
  color: var(--sh-text-tertiary);
  white-space: nowrap;
}

/* 折叠态：仅保留图标 */
body.sh-collapsed .sh-sidebar { inline-size: 56px; padding: 10px 6px 16px; }
body.sh-collapsed .sh-nav-group {
  block-size: 1px;
  margin: 8px 8px;
  background: var(--sh-border);
  font-size: 0;
  overflow: hidden;
}
body.sh-collapsed .sh-nav-item { justify-content: center; padding: 9px 0; gap: 0; }
body.sh-collapsed .sh-nav-item.active::before { inset-inline-start: 0; }
body.sh-collapsed .sh-nav-label, body.sh-collapsed .sh-nav-footer { display: none; }

/* 内容工作区 */
body.sh-on { padding: var(--sh-appbar-h) 0 0 var(--sh-sidebar-w); min-height: 100vh; max-width: none; margin: 0; }
body.sh-on.sh-collapsed { padding-inline-start: 56px; }
.sh-workspace {
  inline-size: 100%;
  min-block-size: calc(100vh - var(--sh-appbar-h));
  padding: 0 var(--sh-space-7) var(--sh-space-8);
  background: var(--sh-bg);
  overflow-x: clip;
}

/* 页首横幅 */
body.sh-on .sh-workspace > .page-head,
body.sh-on .sh-workspace > .topbar {
  min-block-size: 88px;
  margin: 0 calc(var(--sh-space-7) * -1) var(--sh-space-5);
  padding: 20px var(--sh-space-7);
  background: linear-gradient(180deg, var(--sh-surface), color-mix(in srgb, var(--sh-surface) 86%, var(--sh-bg)));
  border-block-end: 1px solid var(--sh-border);
  box-shadow: none;
  display: flex;
  align-items: center;
  gap: var(--sh-space-3);
}
body.sh-on .sh-workspace > .topbar { justify-content: space-between; gap: var(--sh-space-4); }
body.sh-on .sh-workspace > .page-head h1,
body.sh-on .sh-workspace > .topbar h1 { font-size: 22px; line-height: 30px; letter-spacing: -.02em; font-weight: 600; }
body.sh-on .sh-workspace > .page-head .back-link,
body.sh-on .sh-workspace > .topbar .back-link { margin-inline-start: auto; }

body.sh-on .sh-workspace > .card {
  max-width: none;
  margin: 0 0 var(--sh-space-4);
  padding: var(--sh-space-4);
  background: var(--sh-surface);
  border: 1px solid var(--sh-border);
  border-radius: var(--sh-radius-lg);
}

/* 页内旧元素避让 */
body.sh-on .user-bar { display: none !important; }
body.sh-on .topbar .topbar-right { display: none; }
html.sh-scroll { scroll-padding-top: calc(var(--sh-appbar-h) + 16px); }

/* 移动端抽屉 */
.sh-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: var(--sh-z-mask);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}

/* 访客演示模式提示条 */
.sh-demo-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: var(--sh-space-4);
  padding: 10px 16px;
  border-radius: var(--sh-radius-lg);
  border: 1px solid color-mix(in srgb, var(--sh-warning) 34%, transparent);
  background: var(--sh-warning-soft);
  color: var(--sh-text);
  font-size: var(--sh-font-size-sm);
}
.sh-demo-banner b {
  color: var(--sh-warning);
  font-weight: 600;
  letter-spacing: .3px;
}

/* ==================== 响应式 ==================== */
@media (max-width: 1200px) {
  .sh-workspace { padding-inline: var(--sh-space-6); }
  body.sh-on .sh-workspace > .page-head,
  body.sh-on .sh-workspace > .topbar {
    margin-inline: calc(var(--sh-space-6) * -1);
    padding-inline: var(--sh-space-6);
  }
}

@media (max-width: 900px) {
  body.sh-on, body.sh-on.sh-collapsed { padding-inline-start: 0; }
  .sh-workspace { padding: 0 var(--sh-space-4) var(--sh-space-6); }
  body.sh-on .sh-workspace > .page-head,
  body.sh-on .sh-workspace > .topbar {
    min-block-size: 76px;
    margin-inline: calc(var(--sh-space-4) * -1);
    padding-inline: var(--sh-space-4);
    margin-bottom: var(--sh-space-4);
  }
  body.sh-on .sh-workspace > .page-head h1,
  body.sh-on .sh-workspace > .topbar h1 { font-size: var(--sh-font-size-xl); }
  body.sh-collapsed .sh-sidebar { inline-size: var(--sh-sidebar-w); padding: 10px 10px 16px; }
  body.sh-collapsed .sh-nav-group {
    margin: var(--sh-space-4) 10px var(--sh-space-1);
    text-align: start;
    font-size: 11px;
    letter-spacing: .08em;
  }
  body.sh-collapsed .sh-nav-item { justify-content: flex-start; padding: 8px 10px; gap: 10px; }
  body.sh-collapsed .sh-nav-label, body.sh-collapsed .sh-nav-footer { display: block; }
  .sh-sidebar, body.sh-collapsed .sh-sidebar {
    translate: -102% 0;
    inline-size: var(--sh-sidebar-w);
    box-shadow: var(--sh-shadow-3);
  }
  body.sh-drawer .sh-sidebar { translate: none; }
  body.sh-drawer .sh-mask { opacity: 1; pointer-events: auto; }
  .sh-product { display: none; }
  .sh-user .sh-act.pwd { display: none; }
  .modal { inline-size: 100%; padding: var(--sh-space-4); }
}

@media (max-width: 640px) {
  body { font-size: var(--sh-font-size-sm); }
  .page-head { gap: 10px; }
  .card { border-radius: var(--sh-radius); padding: var(--sh-space-3); }
  .table-wrap { border-radius: var(--sh-radius-sm); }
  input, select, textarea { max-width: 100%; }
  .sh-user .sh-uname, .sh-user .sh-role { display: none; }
  .sh-user .sh-act { padding: 2px 8px; }
  .form-grid { grid-template-columns: 1fr; }
  .card h2, .card-title { font-size: var(--sh-font-size-sm); }
}

/* 触控设备放大点击目标（WCAG 2.5.8） */
@media (pointer: coarse) {
  button, .btn, .tab-btn, .pagination button, .pager button {
    min-block-size: var(--sh-control-height);
  }
  .sh-iconbtn { inline-size: 40px; block-size: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

@media (forced-colors: active) {
  .card, .table-wrap, .modal, input, select, textarea { border: 1px solid CanvasText; }
  .dot, .sh-brand-mark { forced-color-adjust: none; }
}
