/* Miyo 控制台 · 统一布局（侧边栏 / 顶栏 / 手机抽屉 / 内容区）
 * 覆盖旧版 190px 静态侧栏与底部 Tab。
 */

:root {
  --miyo-bg: #f4f5fa;
  --miyo-card: #ffffff;
  --miyo-text: #2b2d3a;
  --miyo-muted: #7c8198;
  --miyo-line: #eceef6;
  --miyo-primary: #8b8cbe;
  --miyo-primary-strong: #7071a8;
  --miyo-primary-soft: #eef0fa;
  --miyo-radius: 12px;
  --miyo-shadow: 0 8px 28px rgba(80, 82, 120, .08);
}

html, body {
  background: var(--miyo-bg) !important;
  color-scheme: light;
  color: var(--miyo-text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* 旧模板以 75px 作为 rem 基准（原本写在各页 html 的内联 style 上），新页面统一补齐 */
html { font-size: 75px; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif !important;
  min-height: 100vh;
}

.template { background: var(--miyo-bg); min-height: 100vh; }
.el-container.console-shell { min-height: 100vh; align-items: stretch; }
/* 侧栏后面的内容容器改为纵向布局（旧模板依赖 fixed header，这里统一改为 sticky 纵排） */
aside.el-aside + section.el-container {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  min-height: 100vh;
}

/* ---------------- 侧边栏 ---------------- */
aside.el-aside {
  position: sticky !important;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: #fff !important;
  border-right: 1px solid var(--miyo-line);
  padding: 0 !important;
  z-index: 20;
  scrollbar-width: thin;
  scrollbar-color: #d9dbe8 transparent;
}
aside.el-aside::-webkit-scrollbar { width: 6px; }
aside.el-aside::-webkit-scrollbar-thumb { background: #d9dbe8; border-radius: 6px; }

.miyo-brand { padding: 18px 16px 14px; }
.miyo-brand-link { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--miyo-text); }
.miyo-brand-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, #9a9bcc 0%, #7d7eb8 100%);
  box-shadow: 0 6px 14px rgba(139, 140, 190, .28);
}
.miyo-brand-mark svg { width: 21px; height: 21px; }
.miyo-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.miyo-brand-text b { font-size: 15.5px; letter-spacing: .3px; font-weight: 700; }
.miyo-brand-text small { font-size: 8.5px; letter-spacing: 2.2px; color: #a0a4b8; margin-top: 3px; }

.miyo-nav { padding: 0 10px 10px; }
.miyo-nav-group { padding-bottom: 2px; }
.miyo-nav-label {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 8px 5px; font-size: 10.5px; letter-spacing: 1.2px;
  color: #a3a7ba; font-weight: 600;
}
.miyo-nav-all {
  display: inline-flex; align-items: center; gap: 2px;
  color: #b0b3c4; text-decoration: none; font-size: 10px; letter-spacing: 0;
}
.miyo-nav-all svg { width: 11px; height: 11px; }
.miyo-nav-all:hover { color: var(--miyo-primary-strong); }

.miyo-nav-item {
  position: relative;
  display: flex; align-items: center; gap: 9px;
  min-height: 34px; padding: 6px 9px;
  border-radius: 9px; text-decoration: none;
  color: #555a70; font-size: 13px;
  transition: background .16s ease, color .16s ease;
  margin-bottom: 1px;
}
.miyo-nav-item:hover { background: #f6f7fc; color: var(--miyo-text); }
.miyo-nav-item.is-active { background: var(--miyo-primary-soft); color: var(--miyo-primary-strong); font-weight: 600; }
.miyo-nav-item.is-active::before {
  content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--miyo-primary);
}
.miyo-nav-icon { width: 18px; height: 18px; display: inline-flex; flex: 0 0 auto; color: #9b9fb4; }
.miyo-nav-item.is-active .miyo-nav-icon { color: var(--miyo-primary); }
.miyo-ic { width: 18px; height: 18px; display: block; }
.miyo-nav-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.miyo-nav-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.miyo-nav-desc { display: none; }
.miyo-nav-badge {
  margin-left: auto; flex: 0 0 auto;
  font-size: 9.5px; line-height: 1; padding: 3px 5px; border-radius: 5px;
  color: var(--miyo-primary-strong); background: #e9eafa; font-weight: 600;
  transform: scale(.94);
}
.miyo-nav-item.is-active .miyo-nav-badge { background: #fff; color: var(--miyo-primary-strong); }
.miyo-nav-foot {
  display: flex; align-items: center; gap: 7px;
  margin: 6px 18px 16px; padding-top: 12px;
  border-top: 1px solid var(--miyo-line);
  font-size: 12px; color: #9a9eb2; text-decoration: none;
}
.miyo-nav-foot:hover { color: var(--miyo-primary-strong); }
.miyo-nav-foot svg { width: 15px; height: 15px; }

/* ---------------- 顶栏 ---------------- */
header.el-header.miyo-header {
  height: 62px !important;
  width: auto !important;
  left: auto !important;
  position: sticky; top: 0; z-index: 15;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 0 22px !important;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--miyo-line);
}
.miyo-header-left, .miyo-header-right { display: flex; align-items: center; gap: 14px; min-width: 0; }
.miyo-header-left { flex: 1 1 auto; }
.miyo-header-right { flex: 0 0 auto; }
.miyo-hamburger {
  display: none; width: 34px; height: 34px; border: 0; border-radius: 9px;
  background: #f3f4fa; color: #5d6178; align-items: center; justify-content: center; cursor: pointer;
}
.miyo-crumb { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: #a0a4b8; white-space: nowrap; overflow: hidden; }
.miyo-crumb a { color: #a0a4b8; text-decoration: none; }
.miyo-crumb a:hover { color: var(--miyo-primary-strong); }
.miyo-crumb b { color: #4a4e63; font-weight: 600; }
.miyo-crumb span { color: #d0d2de; }

.miyo-search { position: relative; width: 240px; }
.miyo-search-ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #a7abbe; display: flex; }
.miyo-search-ic svg { width: 15px; height: 15px; }
.miyo-search input {
  box-sizing: border-box;
  width: 100%; height: 34px; padding: 0 32px 0 32px;
  border: 1px solid transparent; border-radius: 9px;
  background: #f4f5fa; color: #3d4053; font-size: 12.5px; outline: none;
  transition: border-color .16s, background .16s, box-shadow .16s;
}
.miyo-search input::placeholder { color: #a7abbe; }
.miyo-search input:focus { background: #fff; border-color: #d9dbec; box-shadow: 0 0 0 3px rgba(139, 140, 190, .10); }
.miyo-search kbd {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  font-size: 10px; color: #b3b6c8; border: 1px solid #e2e4ef; border-radius: 4px;
  padding: 0 4px; line-height: 16px; background: #fff; font-family: inherit;
}
.miyo-search-pop {
  position: absolute; top: 40px; left: 0; right: 0; min-width: 300px;
  background: #fff; border: 1px solid var(--miyo-line); border-radius: 12px;
  box-shadow: var(--miyo-shadow); padding: 6px; z-index: 50;
}
.miyo-search-row { display: flex; align-items: center; gap: 9px; padding: 8px 9px; border-radius: 8px; text-decoration: none; color: var(--miyo-text); }
.miyo-search-row:hover { background: #f5f6fc; }
.miyo-search-row-ic { width: 28px; height: 28px; border-radius: 8px; background: var(--miyo-primary-soft); color: var(--miyo-primary-strong); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.miyo-search-row-ic svg { width: 16px; height: 16px; }
.miyo-search-row b { display: block; font-size: 12.5px; font-weight: 600; }
.miyo-search-row small { display: block; font-size: 10.5px; color: #a0a4b8; margin-top: 1px; }
.miyo-search-empty { padding: 14px 12px; font-size: 12px; color: #9a9eb2; line-height: 1.6; }

.miyo-head-links { display: flex; align-items: center; gap: 16px; }
.miyo-head-links a { font-size: 12.5px; color: #6b7086; text-decoration: none; white-space: nowrap; }
.miyo-head-links a:hover { color: var(--miyo-primary-strong); }
.miyo-icon-btn { position: relative; width: 32px; height: 32px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; color: #7d8298; background: transparent; text-decoration: none; }
.miyo-icon-btn:hover { background: #f4f5fa; color: var(--miyo-primary-strong); }
.miyo-dot { position: absolute; right: 7px; top: 6px; width: 6px; height: 6px; border-radius: 50%; background: #ff7a7a; border: 1.5px solid #fff; }
.miyo-user { position: relative; }
.miyo-user-btn {
  display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 8px 0 4px;
  border: 0; border-radius: 9px; background: transparent; cursor: pointer; color: #4a4e63; font-size: 12.5px;
}
.miyo-user-btn:hover { background: #f4f5fa; }
.miyo-avatar { width: 26px; height: 26px; border-radius: 8px; background: #dbe6bf; color: #4d5c2c; font-weight: 700; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.miyo-user-name { max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.miyo-user-arrow { width: 13px; height: 13px; color: #a6aabc; transition: transform .16s; }
.miyo-user.is-open .miyo-user-arrow { transform: rotate(90deg); }
.miyo-user-pop {
  display: none; position: absolute; right: 0; top: 40px; width: 214px;
  background: #fff; border: 1px solid var(--miyo-line); border-radius: 12px;
  box-shadow: var(--miyo-shadow); padding: 6px; z-index: 60;
}
.miyo-user.is-open .miyo-user-pop { display: block; }
.miyo-user-pop-head { padding: 10px 10px 9px; border-bottom: 1px solid var(--miyo-line); margin-bottom: 4px; }
.miyo-user-pop-head b { display: block; font-size: 13px; }
.miyo-user-pop-head span { display: block; font-size: 10.5px; color: #a0a4b8; margin-top: 2px; }
.miyo-user-pop a { display: block; padding: 8px 10px; border-radius: 7px; font-size: 12.5px; color: #4a4e63; text-decoration: none; }
.miyo-user-pop a:hover { background: #f5f6fc; }
.miyo-user-pop a.is-danger { color: #e05c5c; }
.miyo-demo-badge {
  font-size: 10px; color: #9a9eb2; background: #f2f3f8; border: 1px solid #e8eaf2;
  padding: 3px 7px; border-radius: 20px; white-space: nowrap;
}

/* ---------------- 内容区 ---------------- */
main.el-main {
  padding: 22px !important;
  background: transparent !important;
  min-height: calc(100vh - 62px);
  width: auto !important;
  flex: 1 1 auto;
  overflow-x: hidden;
}
.miyo-table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.miyo-table-scroll .el-table { min-width: 720px; }

/* ---------------- 手机抽屉 ---------------- */
.miyo-drawer {
  position: fixed; left: 0; top: 0; bottom: 0; width: min(84vw, 320px);
  background: #fff; z-index: 2000;
  transform: translateX(-102%); transition: none;
  overflow-y: auto; box-shadow: 18px 0 40px rgba(35, 37, 60, .16);
  padding-bottom: 18px;
}
.miyo-drawer .miyo-brand { display: flex; align-items: center; justify-content: space-between; }
.miyo-drawer .miyo-nav { padding: 0 12px 10px; }
.miyo-drawer .miyo-nav-item { min-height: 42px; font-size: 14px; }
.miyo-drawer .miyo-nav-desc { display: block; font-size: 10.5px; color: #a0a4b8; margin-top: 2px; }
.miyo-drawer .miyo-nav-item.is-active::before { left: -12px; }
.miyo-drawer-close {
  width: 34px; height: 34px; border: 0; border-radius: 9px; background: #f4f5fa;
  color: #6b7086; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.miyo-overlay {
  position: fixed; inset: 0; background: rgba(28, 30, 48, .38);
  z-index: 1999; opacity: 0; pointer-events: none; transition: opacity .2s;
}
body.miyo-drawer-open { overflow: hidden; }
body.miyo-drawer-open .miyo-drawer { transform: translateX(0); }
body.miyo-drawer-open .miyo-overlay { opacity: 1; pointer-events: auto; }

/* ---------------- Toast ---------------- */
.miyo-toast {
  position: fixed; left: 50%; top: 84px; transform: translate(-50%, -8px);
  background: #2f3246; color: #fff; font-size: 13px; line-height: 1.4;
  padding: 10px 18px; border-radius: 10px; z-index: 3000;
  box-shadow: 0 10px 30px rgba(30, 32, 55, .25);
  opacity: 0; transition: opacity .2s, transform .2s; max-width: min(88vw, 460px);
  text-align: center;
}
.miyo-toast.show { opacity: 1; transform: translate(-50%, 0); }
.miyo-toast.is-success { background: #3f7d5a; }
.miyo-toast.is-error { background: #b64a4a; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1180px) {
  .miyo-head-links { display: none; }
  .miyo-search { width: 200px; }
  .miyo-demo-badge { display: none; }
}

@media (max-width: 1024px) {
  aside.el-aside { display: none !important; }
  .miyo-hamburger { display: inline-flex; }
  header.el-header.miyo-header { height: 56px !important; padding: 0 14px !important; }
  main.el-main { padding: 14px !important; min-height: calc(100vh - 56px); }
  .miyo-search { display: none; }
  .miyo-user-name { display: none; }
  .miyo-icon-btn { width: 30px; height: 30px; }
  .miyo-header-right { gap: 4px; }
  .miyo-crumb { font-size: 12px; gap: 5px; }
  .miyo-crumb a:first-child, .miyo-crumb span:first-of-type { display: none; }
  .miyo-crumb b { max-width: 52vw; overflow: hidden; text-overflow: ellipsis; }
}

@media (min-width: 1025px) {
  .miyo-drawer, .miyo-overlay { display: none; }
}

@media (max-width: 480px) {
  .miyo-crumb { font-size: 11.5px; }
  main.el-main { padding: 12px !important; }
  .miyo-toast { top: 70px; }
}
