/* 北境云 Web 标准壳：登录 + 侧栏 + 顶栏（强制盖过桌面 absolute 布局） */

html, body {
  height: 100%;
  margin: 0;
}

body.web-app {
  min-height: 100%;
  background: #f4f6f8;
  color: #0f172a;
  -webkit-app-region: no-drag !important;
  app-region: no-drag !important;
}

body.web-app * {
  -webkit-app-region: no-drag !important;
  app-region: no-drag !important;
}

.window-actions,
.login-window-actions,
.win-btn,
.nav-slider,
.backdrop,
.orb {
  display: none !important;
}

/* ========== 登录 ========== */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(15, 118, 110, 0.16), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(37, 99, 235, 0.10), transparent 50%),
    #eef2f6;
  position: relative !important;
  inset: auto !important;
}

.auth-page[hidden] {
  display: none !important;
}

.auth-card {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

.auth-brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 22px;
}

.auth-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
}

.auth-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.auth-subtitle {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 13px;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-field {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: #334155;
}

.auth-field .input {
  height: 40px;
  font-size: 14px;
}

.auth-error,
.login-error {
  min-height: 18px;
  color: #dc2626;
  font-size: 13px;
}

.auth-submit {
  height: 42px;
  width: 100%;
  margin-top: 4px;
}

.auth-foot {
  margin: 16px 0 0;
  color: #94a3b8;
  font-size: 12px;
  text-align: center;
}

/* ========== 应用壳（关键：禁止 absolute 铺满） ========== */
body.web-app .app-shell,
.app-shell {
  position: relative !important;
  inset: auto !important;
  display: grid !important;
  grid-template-columns: 232px 1fr !important;
  width: 100% !important;
  min-height: 100vh !important;
  height: auto !important;
  background: #f4f6f8 !important;
  z-index: auto !important;
}

.app-shell[hidden] {
  display: none !important;
}

.app-shell.is-sidebar-collapsed {
  grid-template-columns: 0 1fr !important;
}

.app-shell.is-sidebar-collapsed .app-sidebar {
  overflow: hidden !important;
  border: 0 !important;
  padding: 0 !important;
}

body.web-app .app-sidebar,
.app-sidebar {
  position: relative !important;
  inset: auto !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 8px;
  padding: 16px 12px !important;
  background: #0f172a !important;
  color: #e2e8f0 !important;
  border-right: 1px solid #1e293b;
  min-height: 100vh !important;
  z-index: 5 !important;
  width: auto !important;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 16px;
}

.sidebar-brand img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.sidebar-brand strong {
  display: block;
  font-size: 15px;
}

.sidebar-brand span {
  color: #94a3b8;
  font-size: 12px;
}

.sidebar-nav {
  display: grid;
  gap: 4px;
  flex: 1;
  align-content: start;
}

body.web-app .sidebar-link.nav-item,
.sidebar-link.nav-item {
  width: 100% !important;
  height: 40px !important;
  padding: 0 12px !important;
  border: 0 !important;
  border-radius: 10px !important;
  background: transparent !important;
  color: #cbd5e1 !important;
  text-align: left !important;
  font: inherit !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
}

body.web-app .sidebar-link.nav-item:hover {
  background: rgba(148, 163, 184, 0.12) !important;
  color: #fff !important;
}

body.web-app .sidebar-link.nav-item.is-active {
  background: #0f766e !important;
  color: #fff !important;
}

.sidebar-foot {
  padding: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.sidebar-account-name {
  font-weight: 700;
  font-size: 13px;
}

.sidebar-account-meta {
  margin-top: 2px;
  color: #94a3b8;
  font-size: 12px;
}

body.web-app .app-main,
.app-main {
  position: relative !important;
  inset: auto !important;
  display: grid !important;
  grid-template-rows: 56px 1fr !important;
  min-width: 0 !important;
  min-height: 100vh !important;
}

.app-topbar {
  position: sticky !important;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.topbar-account-btn {
  height: 34px;
  padding: 0 12px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
}

body.web-app .account-menu {
  position: relative;
}

body.web-app .account-popover {
  right: 0;
  left: auto;
}

body.web-app .app-content,
.app-content {
  position: relative !important;
  inset: auto !important;
  min-height: 0 !important;
  overflow: auto !important;
  padding: 12px !important;
}

/* 业务 view：禁止 absolute 盖满 */
body.web-app .view,
body.web-app .app-view,
.app-view.view {
  position: relative !important;
  inset: auto !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  bottom: auto !important;
  display: block !important;
  width: auto !important;
  height: auto !important;
  min-height: calc(100vh - 56px - 24px) !important;
  padding: 0 !important;
  z-index: auto !important;
}

body.web-app .view[hidden],
body.web-app .app-view[hidden],
.app-view.view[hidden] {
  display: none !important;
}

/* 采集箱 */
body.web-app .workbench,
.workbench {
  position: relative !important;
  inset: auto !important;
  display: grid !important;
  grid-template-columns: minmax(300px, 1.05fr) minmax(320px, 0.95fr) !important;
  gap: 12px !important;
  height: calc(100vh - 56px - 24px) !important;
  min-height: 520px !important;
  padding: 0 !important;
}

body.web-app .workbench > .column {
  position: relative !important;
  inset: auto !important;
  display: flex !important;
  flex-direction: column !important;
  min-width: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
  background: #fff !important;
  border: 1px solid #e6ebf2 !important;
  border-radius: 12px !important;
}

body.web-app .column-head {
  flex: none !important;
  background: #f8fafc !important;
}

body.web-app .column-scroll {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow: auto !important;
  background: #fff !important;
}

body.web-app #detailScroll .empty,
body.web-app #productList .empty {
  min-height: 280px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  color: #64748b !important;
  padding: 32px 16px !important;
}

body.web-app #detailScroll .empty-title,
body.web-app #productList .empty-title {
  color: #0f172a !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  margin-top: 8px !important;
}

body.web-app #detailScroll .empty-text,
body.web-app #productList .empty-text {
  margin-top: 6px !important;
  max-width: 280px !important;
  line-height: 1.5 !important;
}

@media (max-width: 960px) {
  body.web-app .app-shell,
  .app-shell {
    grid-template-columns: 1fr !important;
  }

  body.web-app .app-sidebar,
  .app-sidebar {
    position: fixed !important;
    inset: 0 auto 0 0 !important;
    width: min(80vw, 260px) !important;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    z-index: 40 !important;
  }

  body.web-app .app-shell.is-sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  body.web-app .workbench,
  .workbench {
    grid-template-columns: 1fr !important;
    height: auto !important;
    min-height: 70vh !important;
  }
}
