/* YthLink pages —— 页面级布局，一页一段。
   依赖 css/tokens.css 与 css/ui.css，必须在二者之后引入。类名前缀 p-。
   只使用 token 变量，不写硬编码颜色，不写 !important。
   本次仅首页 `/`（public/index.html）。 */

/* ================= 首页 / ================= */

body.home {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

/* ---- 顶栏：高 64，底部 1px 边框，左右 padding 32，内部 1120 居中 ---- */
.p-top {
  flex: none;
  height: 64px;
  padding: 0 var(--sp-8);
  border-bottom: 1px solid var(--border);
}
.p-top-in {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
  max-width: 1120px;
  height: 100%;
  margin: 0 auto;
}
.p-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-18);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.01em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.p-brand:hover { color: var(--text); text-decoration: none; }
.p-brand-seal { display: block; flex: none; width: 28px; height: 28px; }
.p-brand-yth { color: var(--text); }
.p-brand-link { color: var(--primary); }

.p-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
  margin-left: auto;
}
.p-link {
  font-size: var(--fs-13);
  line-height: 1;
  color: var(--text-2);
  text-decoration: none;
  white-space: nowrap;
  transition: color .15s ease;
}
.p-link:hover { color: var(--primary); text-decoration: none; }
/* 分隔点：基线隐藏、≥768 才显示。这样移动端即使脚本把 inline display 置空，
   也不会退回成可见（避免用 !important 去压内联样式）。 */
.p-sep {
  display: none;
  font-size: var(--fs-13);
  line-height: 1;
  color: var(--border-2);
  user-select: none;
}
@media (min-width: 768px) {
  .p-sep { display: inline; }
}
.p-cta-top { height: 34px; }

/* ---- 主区：纵向居中，min-height calc(100vh - 144px)，gap 20 ---- */
.p-hero {
  box-sizing: border-box;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-5);
  min-height: calc(100vh - 144px);
  padding: var(--sp-10) var(--sp-6);
  text-align: center;
}
.p-seal { display: block; width: 88px; height: 88px; }
.p-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 56px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.5px;
  color: var(--text);
}
.p-title-yth { color: var(--text); }
.p-title-link { color: var(--primary); }
.p-sub {
  margin: 0;
  font-size: var(--fs-15);
  line-height: 1.6;
  letter-spacing: .02em;
  color: var(--text-2);
}

.p-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--sp-3);
}
.p-cta {
  height: 42px;
  padding: 0 var(--sp-6);
  font-size: var(--fs-14);
  letter-spacing: .02em;
}
.p-btn-alt {
  height: 42px;
  padding: 0 var(--sp-5);
  font-size: var(--fs-14);
}

/* ---- 网关地址复制条：420 × 40 ---- */
.p-urlbar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 420px;
  max-width: 100%;
  height: 40px;
  padding: 0 var(--sp-2) 0 14px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  text-align: left;
}
.p-url {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--mono);
  font-size: var(--fs-12);
  line-height: 1;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.p-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: color .15s ease, background-color .15s ease;
}
.p-copy:hover { color: var(--primary); background: var(--primary-bg); }
.p-copy:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.p-copy.is-done { color: var(--ok); background: transparent; }

/* ---- 公告细条（元素同时带旧 class .notice，这里覆盖旧样式） ---- */
.p-notice {
  max-width: 560px;
  margin: 0;
  padding: var(--sp-2) 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary-bg);
  color: var(--primary);
  font-size: var(--fs-12);
  line-height: 1.6;
  text-align: center;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---- 状态行：12px 弱文字 + 6px 圆点（元素 class 由脚本设为 home-status ok/warn） ---- */
.home-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 18px;
  margin: 0;
  font-family: var(--mono);
  font-size: var(--fs-12);
  line-height: 1.5;
  letter-spacing: .02em;
  color: var(--text-3);
}
.home-status::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-2);
}
.home-status.ok::before { background: var(--ok); }
.home-status.warn::before { background: var(--primary); }
.home-status:empty::before { display: none; }

/* ---- 页脚：与顶栏合计 144px 高度预算 ---- */
.p-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  height: 80px;
  padding: 0 var(--sp-4);
  font-size: var(--fs-12);
  line-height: 1.5;
  letter-spacing: .06em;
  color: var(--text-3);
  text-align: center;
}

/* ---- 768–1023 ---- */
@media (max-width: 1023px) {
  .p-top { padding: 0 var(--sp-6); }
  .p-nav { gap: var(--sp-4); }
  .p-hero { gap: var(--sp-4); padding: var(--sp-8) var(--sp-5); }
  .p-seal { width: 72px; height: 72px; }
  .p-title { font-size: 44px; }
  .p-urlbar { width: 380px; }
}

/* ---- <768 ---- */
@media (max-width: 767px) {
  .p-top { padding: 0 var(--sp-4); }
  .p-brand { font-size: var(--fs-16); }
  .p-brand-seal { width: 24px; height: 24px; }
  .p-nav { gap: var(--sp-3); }
  /* 移动端顶栏收起次要文字入口（主区内已有同按钮），保住主 CTA 不被挤压溢出 */
  .p-link-info { display: none; }
  .p-hero { gap: var(--sp-4); padding: var(--sp-6) var(--sp-4); }
  .p-seal { width: 64px; height: 64px; }
  .p-title { font-size: 34px; letter-spacing: -.3px; }
  .p-sub { font-size: var(--fs-13); }
  .p-actions { width: 100%; flex-direction: column; }
  .p-cta,
  .p-btn-alt { width: 100%; max-width: 320px; }
  .p-urlbar { width: 100%; max-width: 360px; }
  .p-notice { max-width: 100%; }
  .p-foot { height: 64px; letter-spacing: .02em; }
}
/* ===== auth pages ===== */
/* 登录 / 注册（SPEC §3.2）：左 44% 品牌栏 + 右 56% 白卡表单。
   只引用 token 变量；小眼睛沿用 style.css 的 .pwd-wrap / .pwd-eye / .is-show 钩子。 */

body.p-auth {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

/* ---- 左栏：底 --paper-deep，内容垂直居中左对齐，右下角印章水印被 overflow 裁切 ---- */
.p-auth-left {
  position: relative;
  display: flex;
  flex: 0 0 44%;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  padding: 56px;
  overflow: hidden;
  background: var(--paper-deep);
}
.p-auth-brand {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-4);
}
.p-auth-seal { display: block; flex: none; width: 56px; height: 56px; }
.p-auth-word {
  margin: 0;
  font-family: var(--serif);
  font-size: var(--fs-28);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.3px;
}
.p-auth-word-yth { color: var(--text); }
.p-auth-word-link { color: var(--primary); }
.p-auth-slogan {
  margin: 0;
  font-size: var(--fs-13);
  line-height: 1.6;
  letter-spacing: .06em;
  color: var(--text-3);
}
.p-auth-mark {
  position: absolute;
  right: -96px;
  bottom: -104px;
  width: 320px;
  height: 320px;
  opacity: .06;
  pointer-events: none;
  user-select: none;
}

/* ---- 右栏：底 --bg，居中白卡 380 ---- */
.p-auth-right {
  display: flex;
  flex: 0 0 56%;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--sp-8) var(--sp-6);
  background: var(--bg);
}
.p-auth-card {
  width: 380px;
  max-width: 100%;
  padding: var(--sp-8);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
}
.p-auth-title {
  margin: 0;
  font-family: var(--serif);
  font-size: var(--fs-22);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}
.p-auth-sub {
  margin: var(--sp-1) 0 var(--sp-6);
  font-size: var(--fs-13);
  line-height: 1.5;
  color: var(--text-3);
}

/* ---- 表单：字段间距 16 ---- */
.p-auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}
/* 验证码一行：input 撑满 + 固定宽 110 / 高 36 的发送按钮，间距 8 */
.p-auth-code {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.p-auth-code .y-input { flex: 1 1 auto; min-width: 0; }
.p-auth-send {
  flex: none;
  width: 110px;
  height: 36px;
  padding: 0;
}
/* 主按钮整宽、高 40 */
.p-auth-submit {
  width: 100%;
  height: 40px;
}
/* 注册关闭 / 邮件未配置的提示条 */
.p-auth-notice {
  margin: 0 0 var(--sp-4);
  padding: var(--sp-2) 14px;
  border-radius: var(--radius-sm);
  background: var(--primary-bg);
  color: var(--primary-h);
  font-size: var(--fs-13);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
/* msg：13px、预留 20px 高度防跳动。颜色沿用 style.css 的 .msg.err / .msg.ok，
   这里只兜住没有 err/ok 时的默认红，不去压制 .msg.ok。 */
.p-auth .msg {
  margin: var(--sp-3) 0 0;
  font-size: var(--fs-13);
  line-height: 1.5;
  min-height: 20px;
}
.p-auth .msg:not(.ok) { color: var(--err); }
/* 底部「还没有账号？注册」/「已有账号？直接登录」 */
.p-auth-alt {
  margin-top: var(--sp-4);
  font-size: var(--fs-13);
  line-height: 1.6;
  text-align: center;
  color: var(--text-3);
}
.p-auth-alt a { color: var(--primary); }
.p-auth-alt a:hover { color: var(--primary-h); text-decoration: none; }

/* ---- <860：左栏隐藏，右栏占满，卡片 padding 20 ---- */
@media (max-width: 859px) {
  .p-auth-left { display: none; }
  .p-auth-right {
    flex: 1 1 auto;
    width: 100%;
    padding: var(--sp-5);
  }
  .p-auth-card { width: 100%; max-width: 380px; padding: var(--sp-5); }
}

/* ===== console shell ===== */
/* 控制台外壳（SPEC §3.3）：216 侧栏 + 56 顶栏 + 1180 内容区。
   只引用 token 变量（rgba 透明度色除外）；图标类 .i / .i-sm 由 ui.css 提供，此处不重复定义。 */

/* 遮罩：桌面端恒隐藏（抽屉只在 <860 出现），避免它成为 body.flex 的零宽子项 */
.nav-mask { display: none; }

/* ---- 侧栏容器 ---- */
.sidebar {
  width: 216px;
  background: var(--paper-deep);
  border-right: 1px solid var(--border);
}

/* ---- 品牌区：高 64，底部 1px 分隔 ---- */
.cs-brand {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--sp-2);
  height: 64px;
  padding: 0 var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.cs-brand .seal-28 {
  display: block;
  flex: none;
  width: 28px;
  height: 28px;
}
.cs-brand-txt { min-width: 0; }
.cs-brand-name {
  display: block;
  font-size: var(--fs-15);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.01em;
}
.cs-brand-yth { color: var(--text); }
.cs-brand-link { color: var(--primary); }
.cs-brand-sub {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  line-height: 1.2;
  letter-spacing: .5px;
  color: var(--text-3);
}

/* ---- 分组 ---- */
.nav-group { flex: none; padding: var(--sp-4) var(--sp-3) 0; }
.nav-group:first-of-type { padding-top: var(--sp-3); }
.nav-group + .nav-group { padding-top: var(--sp-4); }
.nav-group-title {
  padding: 0 10px var(--sp-2);
  font-size: var(--fs-11);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* ---- 导航项：高 36，圆角 6，图标 16 + 文字 13，间距 10 ---- */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  margin-bottom: 2px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: var(--fs-13);
  font-weight: 400;
  line-height: 1;
  color: var(--text-2);
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.nav-item:hover {
  background: rgba(0, 0, 0, .03);
  color: var(--text);
  text-decoration: none;
}
.nav-item.active {
  background: var(--surface);
  border-color: var(--border);
  color: var(--primary);
  font-weight: 500;
}
.nav-item .i { width: 16px; height: 16px; }
.nav-badge {
  min-width: 18px;
  height: 18px;
  margin-left: auto;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--primary);
  font-family: var(--mono);
  font-size: var(--fs-11);
  line-height: 18px;
  text-align: center;
  color: var(--on-primary);
}
.nav-badge:empty,
.nav-badge[data-zero="1"] { display: none; }

/* ---- 底部用户卡：顶部 1px 分隔，padding 12 ---- */
.sidebar-foot {
  flex: none;
  margin-top: auto;
  padding: var(--sp-3);
  border-top: 1px solid var(--border);
}
.cs-user {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  text-decoration: none;
  transition: background-color .15s ease;
}
.cs-user:hover {
  background: rgba(0, 0, 0, .03);
  text-decoration: none;
  color: var(--text);
}
.cs-user .sc-avatar {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary-bg);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  color: var(--primary);
}
.cs-user-txt {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.cs-user .sc-name {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cs-user .sc-bal {
  margin-top: 0;              /* 压掉 style.css .side-card .sc-bal 的 7px */
  font-family: var(--mono);
  font-size: var(--fs-11);
  line-height: 1.3;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.cs-user .sc-bal b { font-weight: 600; color: inherit; }

/* ---- 主区骨架 ---- */
.main { flex: 1; min-width: 0; }

/* ---- 顶栏：高 56，sticky ---- */
.cs-topbar {
  display: flex;
  flex: none;
  align-items: center;
  height: 56px;
  padding: 0 var(--sp-6);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 20;
}
.cs-topbar .cs-title {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
  color: var(--text);
  white-space: nowrap;
}
.cs-topbar .cs-sub {
  font-size: var(--fs-12);
  line-height: 1;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cs-topbar .spacer { flex: 1 1 auto; }
.cs-topbar #top-checkin { flex: none; }

/* ---- 右上角用户胶囊：高 32，圆角 999 ---- */
.ct-user { position: relative; display: flex; align-items: center; flex: none; }
.cs-topbar .ct-trigger {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  height: 32px;
  padding: 0 10px 0 3px;
  border: 1px solid var(--border-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
}
.cs-topbar .ct-trigger:hover,
.cs-topbar .ct-trigger[aria-expanded="true"] { background: var(--surface-2); }
.cs-topbar .user-avatar {
  width: 26px;
  height: 26px;
  font-size: var(--fs-12);
  font-weight: 600;
  background: var(--primary);
  color: var(--on-primary);
}
.cs-topbar .user-name { font-size: var(--fs-13); color: var(--text); }
/* 下拉菜单跟随外壳基调 */
.ct-menu {
  min-width: 214px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-2);
}
.ct-menu .user-head { border-bottom-color: var(--border); }
.ct-menu .user-menu-item { border-radius: var(--radius-sm); }
.ct-menu .user-menu-item:hover { background: var(--surface-2); }
.ct-menu .user-sep { background: var(--border); }

/* ---- 内容区：#view 外包 .main-body ---- */
.main-body {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px var(--sp-6) 40px;
}
#view { width: 100%; }

/* ---- 弹窗 ---- */
.modal-mask {
  background: rgba(33, 28, 21, .35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.modal-mask.show { display: flex; }
.modal {
  width: 460px;
  padding: var(--sp-5);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-2);
}
.modal h3 {
  margin: 0 0 var(--sp-4);
  font-family: var(--sans);
  font-size: var(--fs-16);
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}
/* 只调字号与行高：不设 color，避免覆盖各视图内嵌套元素的继承色 */
.cs-modal-body {
  font-size: var(--fs-13);
  line-height: 1.6;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  margin-top: var(--sp-5);
}

/* ---- toast：底部居中、深色底白字、圆角 8 ---- */
.toast {
  padding: 9px 16px;
  border-radius: 8px;
  background: var(--text);
  font-size: var(--fs-13);
  color: var(--on-primary);
  box-shadow: var(--shadow-2);
}

/* ---- 移动端（<860）：顶栏换成 44 bar，侧栏抽屉化 ---- */
@media (max-width: 859px) {
  body.shell { flex-direction: column; }

  .cs-topbar { display: none; }

  .mobile-bar {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    height: 44px;
    padding: 0 var(--sp-4);
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 30;
  }
  .cs-mbar .nav-toggle {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
  }
  .cs-mbar .nav-toggle:hover { background: var(--surface-2); color: var(--text); }
  .cs-mbar .mb-title {
    flex: 0 1 auto;
    min-width: 0;
    font-family: var(--sans);
    font-size: var(--fs-15);
    font-weight: 600;
    line-height: 1;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .cs-mbar .mb-spacer { flex: 1 1 auto; }
  .cs-mbar .mb-checkin { flex: none; }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 216px;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 0 0 40px rgba(60, 45, 25, .18);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .nav-mask {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(33, 28, 21, .35);
  }
  body.nav-open .nav-mask { display: block; }

  .main-body { padding: var(--sp-4) var(--sp-4) var(--sp-10); }
  .modal { padding: var(--sp-5) var(--sp-4); }
}

/* ===== 首页复制条微调（验收修正） ===== */
.p-urlbar .p-url,
.p-urlbar code.p-url {
  flex: 1 1 auto;
  width: auto;
  background: none;
  border: none;
  padding: 0 12px;
  font-family: var(--mono);
  font-size: var(--fs-12);
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== 顶栏左侧工具按钮（折叠侧栏 / 新窗口） ===== */
.cs-topbar .cs-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: none;
  margin-right: 2px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.cs-topbar .cs-tool:hover { background: var(--surface-2); color: var(--text); }
.cs-topbar .cs-tool:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.cs-topbar .cs-tool .i { width: 17px; height: 17px; }
.cs-topbar .cs-tool + .cs-tool { margin-left: -4px; }
.cs-topbar .cs-title { margin-left: 6px; }

/* ===== 侧栏折叠态：216 → 64，只留图标 ===== */
.sidebar { transition: width .18s ease; }
body.side-collapsed .sidebar { width: 64px; }
body.side-collapsed .cs-brand { padding: 0; justify-content: center; gap: 0; }
body.side-collapsed .cs-brand-txt { display: none; }
body.side-collapsed .nav-group { padding: var(--sp-3) 8px 0; }
body.side-collapsed .nav-group-title { display: none; }
body.side-collapsed .nav-item {
  justify-content: center;
  gap: 0;
  padding: 0;
  font-size: 0;
}
body.side-collapsed .nav-item .i { width: 18px; height: 18px; }
body.side-collapsed .nav-badge { display: none; }
body.side-collapsed .sidebar-foot { padding: var(--sp-2); }
body.side-collapsed .cs-user { padding: 0; height: 40px; justify-content: center; }
body.side-collapsed .cs-user-txt { display: none; }

@media (max-width: 859px) {
  /* 抽屉模式恢复完整宽度，折叠态不生效 */
  body.side-collapsed .sidebar { width: 246px; }
  body.side-collapsed .cs-brand { padding: 0 var(--sp-4); justify-content: flex-start; gap: var(--sp-2); }
  body.side-collapsed .cs-brand-txt { display: block; }
  body.side-collapsed .nav-group { padding: var(--sp-4) var(--sp-3) 0; }
  body.side-collapsed .nav-group-title { display: block; }
  body.side-collapsed .nav-item { justify-content: flex-start; gap: 10px; padding: 0 10px; font-size: var(--fs-13); }
  body.side-collapsed .nav-badge { display: block; }
  body.side-collapsed .sidebar-foot { padding: var(--sp-3); }
  body.side-collapsed .cs-user { padding: 10px; justify-content: flex-start; height: auto; }
  body.side-collapsed .cs-user-txt { display: block; }
}

/* 移动端顶栏工具按钮 */
.mobile-bar .mb-tool { position: relative; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.mobile-bar .mb-tool .i { width: 17px; height: 17px; }
.mobile-bar .mb-tool .tb-dot { top: -2px; right: -3px; }

/* ===== 控制台顶部导航：替代侧栏，桌面 / 抽屉共用路由 ===== */
body.shell[data-page="console"] { display: block; }
body[data-page="console"] > .main { width: 100%; min-width: 0; }
body[data-page="console"] .cs-topbar {
  display: flex;
  height: 60px;
  min-height: 60px;
  padding: 0 20px;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.cs-topbar .tb-logo { display: flex; flex: none; align-items: center; margin-right: 4px; }
.cs-topbar .tb-logo img { display: block; width: 28px; height: 28px; }
.cs-topbar .top-menu { display: flex; align-items: center; gap: 2px; flex: none; }
.top-menu a, .top-menu summary {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-2);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  list-style: none;
}
.top-menu summary::-webkit-details-marker { display: none; }
.top-menu a:hover, .top-menu summary:hover,
.nav-drawer .nav-item:hover { background: var(--surface-2); text-decoration: none; }
.top-menu .active, .nav-drawer .nav-item.active {
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 600;
  border-color: transparent;
}
.top-menu a:focus-visible, .top-menu summary:focus-visible,
.nav-drawer .nav-item:focus-visible, .cs-topbar .nav-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.top-more { position: relative; }
.top-more-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 184px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-2);
}
.top-menu [hidden], .nav-drawer [hidden] { display: none; }
.cs-topbar .spacer { flex: 1 1 0; min-width: 0; }
body[data-page="console"] .cs-topbar .ct-trigger {
  width: 32px;
  height: 32px;
  padding: 2px;
  justify-content: center;
}
.cs-topbar .ct-trigger .user-name, .cs-topbar .ct-trigger .user-caret { display: none; }
.cs-topbar .nav-toggle { display: none; }
body[data-page="console"] .page-heading { margin-bottom: 16px; }
.page-heading #page-title {
  margin: 0;
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text);
}
.page-heading #page-sub { margin: 4px 0 0; font-size: 12px; line-height: 1.6; color: var(--text-3); }
body[data-page="console"] .main-body { min-width: 0; }
body[data-page="console"] #view { min-width: 0; overflow-wrap: anywhere; }
/* min-content 不应挤大网格；标题和工具条换行，而非盖住相邻模块。 */
body[data-page="console"] .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body[data-page="console"] .grid-2 > *,
body[data-page="console"] .grid-3 > *,
body[data-page="console"] .panel { min-width: 0; }
body[data-page="console"] .panel-head { flex-wrap: wrap; height: auto; }
body[data-page="console"] .panel-head > * { min-width: 0; max-width: 100%; }
body[data-page="console"] .panel-head h2 { flex-shrink: 0; }
body[data-page="console"] .mini-stat .v { overflow-wrap: anywhere; }
body[data-page="console"] .pgt-side { top: 76px; }
.nav-drawer { display: none; }
body[data-page="console"] .nav-mask { display: none; }

@media (max-width: 999px) {
  body[data-page="console"] .cs-topbar { height: 56px; min-height: 56px; padding: 0 16px; gap: 8px; }
  .cs-topbar .tb-logo img { width: 26px; height: 26px; }
  .cs-topbar .top-menu, .cs-topbar #top-checkin { display: none; }
  .cs-topbar .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text-2);
    cursor: pointer;
  }
  .cs-topbar .nav-toggle:hover { background: var(--surface-2); }
  body[data-page="console"].nav-open { overflow: hidden; }
  body[data-page="console"] .nav-drawer {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    max-width: calc(100vw - 40px);
    z-index: 60;
    background: var(--surface);
    border-radius: 0 12px 12px 0;
    box-shadow: var(--shadow-2);
    overflow-y: auto;
    overscroll-behavior: contain;
    visibility: hidden;
    transform: translateX(-100%);
    transition: transform .22s ease, visibility .22s;
  }
  body[data-page="console"].nav-open .nav-drawer { visibility: visible; transform: translateX(0); }
  .nav-drawer .drawer-head { padding: 20px 22px 0; font-size: 15px; font-weight: 600; color: var(--text); }
  .nav-drawer .drawer-foot { margin-top: auto; padding: 16px 12px; border-top: 1px solid var(--border); }
  .nav-drawer .drawer-foot button { width: 100%; font-family: inherit; cursor: pointer; color: var(--err); }
  .nav-drawer .nav-group { padding: 16px 12px 8px; }
  body[data-page="console"].nav-open .nav-mask {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(43,33,20,.4);
  }
}
@media (max-width: 860px) {
  body[data-page="console"] .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  body[data-page="console"] .pgt-side { top: auto; }
}
@media (prefers-reduced-motion: reduce) {
  body[data-page="console"] .nav-drawer { transition: none; }
}

/* 网格内卡片统一顶对齐，网格与前一个面板保留独立间距。 */
body[data-page="console"] #view > .panel + .grid-2 { margin-top: 16px; }
body[data-page="console"] .grid-2 > .panel + .panel { margin-top: 0; }
body[data-page="console"] .ri-sub { flex-wrap: wrap; }

/* ===== 顶栏收尾：手机端减负 + 后台顶栏与前台统一 ===== */
body[data-page="console"] .cs-topbar .tb-tools { gap: 4px; }
body[data-page="console"] .cs-topbar .ct-user { margin-left: 4px; }
body[data-page="console"] .cs-topbar .tb-quota .tb-num { font-size: var(--fs-12); }

/* 手机：搜索 / 通知 / 余额 / 头像 四个入口，语言收进抽屉之外不再占位 */
@media (max-width: 720px) {
  body[data-page="console"] .cs-topbar { padding: 0 12px; gap: 6px; }
  body[data-page="console"] .cs-topbar .tb-quota { width: auto; padding: 0 9px; gap: 4px; }
  body[data-page="console"] .cs-topbar .tb-quota .tb-num { display: inline; }
  body[data-page="console"] .cs-topbar .tb-lang { display: none; }
}

/* 面板里与页面大标题重复的二级标题隐藏 */
#view .panel-head h2.dup-title { display: none; }
#view .panel-head h2.dup-title ~ :last-child { margin-left: auto; }

/* 「更多」面板只在展开时出现：绝对定位会让 details 的默认收起失效 */
.top-more > .top-more-menu { display: none; }
.top-more[open] > .top-more-menu { display: block; }

/* 手机：接口地址卡片标题、说明、按钮各占一行 */
@media (max-width: 640px) {
  /* 接口地址：标题、说明、按钮各占一行，不再挤成一长条 */
  .ep-panel .panel-head .hint { flex-basis: 100%; order: 3; }
  .ep-panel .ep-toggle { margin-left: 0; }
}
