@charset "utf-8";
/* layout.css — 外壳：悬浮玻璃工具栏、玻璃侧边栏、内容区
   只改外观，间距与结构由原 DOM 决定 */

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 12px;
  gap: 12px;
  overflow: hidden;
}

/* ---------- 顶部工具栏：一整块悬浮玻璃 ---------- */
.topbar {
  position: relative;
  z-index: 20;
  flex: 0 0 54px;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 12px 0 18px;
  border-radius: var(--radius-lg);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-inner), var(--glass-edge), var(--shadow-sm), 0 24px 56px rgba(24, 40, 80, 0.07);
}

/* 顶部高光：模拟玻璃上缘的镜面反射 */
.topbar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 55%;
  border-radius: var(--radius-lg) var(--radius-lg) 40% 40% / var(--radius-lg) var(--radius-lg) 100% 100%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: var(--sidebar-w);
  font-weight: 650;
  letter-spacing: -0.01em;
  font-size: 14.5px;
  position: relative;
}
.brand-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background:
    radial-gradient(60% 60% at 32% 28%, #ffffff 0%, rgba(255, 255, 255, 0.55) 34%, rgba(255, 255, 255, 0) 62%),
    linear-gradient(150deg, var(--accent-2), var(--accent));
  box-shadow: 0 0 0 3px rgba(47, 106, 228, 0.1), 0 3px 9px rgba(47, 106, 228, 0.4);
}
.app[data-collapsed="true"] .brand { min-width: var(--sidebar-w-collapsed); }
.app[data-collapsed="true"] .brand-name { display: none; }

/* ---------- 搜索：内凹玻璃胶囊 ---------- */
.search-box { position: relative; flex: 1; max-width: 520px; }
.search-box input {
  width: 100%;
  height: 34px;
  padding: 0 15px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.62);
  color: var(--text);
  outline: none;
  box-shadow: inset 0 1px 2px rgba(18, 28, 45, 0.07), inset 0 0 0 0.5px rgba(18, 28, 45, 0.03);
  transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}
.search-box input::placeholder { color: var(--text-mute); }
.search-box input:focus {
  background: #ffffff;
  border-color: rgba(47, 106, 228, 0.45);
  box-shadow: inset 0 1px 2px rgba(18, 28, 45, 0.04), 0 0 0 3.5px var(--accent-ring);
}

.search-results {
  position: absolute;
  top: 42px;
  left: 0;
  right: 0;
  max-height: 60vh;
  overflow: auto;
  padding: 6px;
  z-index: 50;
  border-radius: var(--radius);
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-inner), var(--shadow);
  animation: dropIn 0.18s var(--ease);
}
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.99); }
  to { opacity: 1; transform: none; }
}
.search-item {
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.14s var(--ease);
}
.search-item:hover, .search-item.active { background: rgba(255, 255, 255, 0.62); }
.search-item .si-module { font-size: 11px; color: var(--accent); letter-spacing: 0.02em; }
.search-item .si-text {
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-empty { padding: 16px; text-align: center; color: var(--text-mute); font-size: 13px; }

.topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; position: relative; }
.save-status { font-size: 12px; color: var(--text-mute); white-space: nowrap; letter-spacing: 0.01em; }
.save-status.error { color: var(--danger); }

/* ---------- 主体双栏 ---------- */
.body { display: flex; flex: 1; min-height: 0; gap: 12px; }

/* ---------- 侧边栏：悬浮玻璃面板 ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  display: flex;
  flex-direction: column;
  padding: 8px;
  border-radius: var(--radius-lg);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-inner), var(--glass-edge), var(--shadow-sm), 0 24px 56px rgba(24, 40, 80, 0.07);
  overflow: hidden;
  transition: width 0.24s var(--ease), flex-basis 0.24s var(--ease);
}
.app[data-collapsed="true"] .sidebar {
  width: var(--sidebar-w-collapsed);
  flex-basis: var(--sidebar-w-collapsed);
}

.collapse-btn {
  width: 28px;
  height: 28px;
  margin: 2px 2px 10px auto;
  padding: 0;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.34);
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1;
  box-shadow: var(--glass-inner), 0 1px 2px rgba(18, 28, 45, 0.05);
  transition: background 0.16s var(--ease), color 0.16s var(--ease), transform 0.24s var(--ease);
}
.collapse-btn:hover { background: rgba(255, 255, 255, 0.72); color: var(--text); }
.collapse-btn:active { transform: scale(0.94); }
.app[data-collapsed="true"] .collapse-btn { transform: rotate(180deg); margin-left: auto; margin-right: auto; }

.nav { padding: 2px 0 8px; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 37px;
  padding: 0 11px;
  border-radius: 11px;
  color: var(--text-soft);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), box-shadow 0.18s var(--ease),
    transform 0.18s var(--ease);
}
.nav-item:hover { background: rgba(255, 255, 255, 0.5); color: var(--text); }
.nav-item:active { transform: scale(0.985); }
/* 选中项：从玻璃里“托起”的一块亮面 */
.nav-item.active {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.62));
  color: var(--accent);
  font-weight: 600;
  border-color: rgba(255, 255, 255, 0.85);
  box-shadow: var(--glass-inner), 0 2px 6px rgba(18, 28, 45, 0.08), 0 10px 22px rgba(18, 28, 45, 0.07);
}
.nav-icon { width: 18px; text-align: center; font-size: 15px; flex: 0 0 18px; }
.nav-text { font-size: 13.5px; letter-spacing: -0.005em; }
.app[data-collapsed="true"] .nav-text { display: none; }
.app[data-collapsed="true"] .nav-item { justify-content: center; padding: 0; }

/* ---------- 主内容区：透明，让玻璃卡片浮在光场上 ---------- */
.main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 10px 64px 4px;
  scrollbar-gutter: stable;
}
.page { max-width: 1180px; margin: 0 auto; }

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding: 2px 2px 0;
}
.page-title {
  font-size: 29px;
  font-weight: 700;
  letter-spacing: -0.028em;
  line-height: 1.18;
}
.page-sub { font-size: 12.5px; color: var(--text-mute); margin-top: 4px; letter-spacing: 0.01em; }
.page-actions { display: flex; gap: 8px; align-items: center; }

/* 窄屏（桌面窗口缩小时）收敛留白 */
@media (max-width: 900px) {
  .app { padding: 8px; gap: 8px; }
  .body { gap: 8px; }
  .main { padding: 6px 4px 48px; }
  .page-title { font-size: 24px; }
}

/* ---------- 手机布局：侧栏变成底部 Tab 栏 ---------- */
@media (max-width: 860px) {
  .app {
    height: 100dvh;
    padding: 0;
    gap: 0;
  }

  /* 顶栏贴边，去掉悬浮留白 */
  .topbar {
    flex: 0 0 52px;
    height: 52px;
    padding: 0 10px;
    gap: 8px;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    box-shadow: var(--glass-inner), 0 8px 24px rgba(24, 40, 80, 0.06);
  }
  .topbar::before { border-radius: 0; }
  .brand { min-width: 0; gap: 0; }
  .brand-name { display: none; }
  .search-box { max-width: none; }
  .search-box input { height: 32px; padding: 0 12px; }
  .topbar-right { gap: 6px; }
  .save-status { display: none; }
  #btn-quick-backup { display: none; }
  .topbar-right .btn { padding: 0 10px; }

  .body { display: block; }

  /* 侧栏 → 底部固定 Tab 栏 */
  .sidebar,
  .app[data-collapsed="true"] .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    flex-basis: auto;
    height: auto;
    z-index: 30;
    flex-direction: row;
    align-items: center;
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0;
    background: var(--glass-strong);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    backdrop-filter: blur(30px) saturate(180%);
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    box-shadow: var(--glass-inner), 0 -10px 30px rgba(18, 28, 45, 0.1);
  }
  .collapse-btn { display: none; }
  .nav {
    flex-direction: row;
    flex: 1;
    gap: 2px;
    padding: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item,
  .app[data-collapsed="true"] .nav-item {
    flex: 0 0 auto;
    flex-direction: column;
    justify-content: center;
    height: 50px;
    min-width: 56px;
    gap: 1px;
    padding: 4px 6px;
    border-radius: 13px;
  }
  .nav-icon { width: auto; flex: 0 0 auto; font-size: 17px; line-height: 1; }
  .nav-text,
  .app[data-collapsed="true"] .nav-text { display: block; font-size: 10px; letter-spacing: 0; }
  .nav-item.active { box-shadow: var(--glass-inner), 0 2px 8px rgba(18, 28, 45, 0.08); }

  /* 模块多于可视宽度时，右缘一道柔光提示还能滑动 */
  .sidebar.nav-scrollable::after {
    content: "";
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 26px;
    border-radius: 0 18px 0 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.78));
    pointer-events: none;
  }

  .main {
    height: calc(100dvh - 52px);
    padding: 10px 12px calc(76px + env(safe-area-inset-bottom));
    scrollbar-gutter: auto;
  }
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 14px;
  }
  .page-title { font-size: 23px; }
  .page-actions { flex-wrap: wrap; gap: 6px; }

  /* iOS 上 16px 以下输入框会触发自动放大 */
  input, textarea, select { font-size: 16px; }
  .btn { min-height: 36px; }

  .net-item { flex-wrap: wrap; }
}

@media (max-width: 560px) {
  .card { padding: 13px; }
  .page-header { margin-bottom: 12px; }
  .kpi-value { font-size: 22px; }
}

