/* ==========================================================================
   EDOMP · 应用外壳布局
   ========================================================================== */

.app-root { height: 100vh; overflow: hidden; }

/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  background: #0d1526;
}
.login-brand {
  position: relative;
  overflow: hidden;
  padding: 56px 60px;
  color: #fff;
  background:
    radial-gradient(900px 500px at 12% 18%, rgba(37, 99, 235, .55), transparent 62%),
    radial-gradient(700px 520px at 82% 88%, rgba(124, 58, 237, .42), transparent 60%),
    linear-gradient(150deg, #0b1424 0%, #122244 55%, #0b1424 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.login-brand::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 46px 46px;
  pointer-events: none;
}
.login-brand__logo { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.login-brand__mark {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6, #7c3aed);
  display: grid; place-items: center;
  font-weight: 800; font-size: 18px; letter-spacing: -.5px;
  box-shadow: 0 8px 24px rgba(59, 130, 246, .45);
}
.login-brand__title { font-size: 19px; font-weight: 700; letter-spacing: .4px; }
.login-brand__sub { font-size: 12px; color: #8fa3c4; letter-spacing: 2.4px; text-transform: uppercase; }

.login-hero { position: relative; z-index: 1; max-width: 560px; }
.login-hero h1 {
  font-size: 40px; line-height: 1.25; font-weight: 700; letter-spacing: -.5px;
  margin-bottom: 18px;
}
.login-hero h1 em { font-style: normal; color: #6ea8ff; }
.login-hero p { color: #9fb2d0; font-size: 14.5px; line-height: 1.85; }

.login-hero__stats { display: flex; gap: 34px; margin-top: 34px; position: relative; z-index: 1; }
.login-hero__stat b { display: block; font-size: 26px; font-weight: 700; color: #fff; letter-spacing: -.5px; }
.login-hero__stat span { font-size: 12px; color: #8fa3c4; }

.login-brand__foot { position: relative; z-index: 1; font-size: 12px; color: #6b7f9e; line-height: 1.9; }

.login-panel {
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.login-form { width: 100%; max-width: 372px; }
.login-form__head { margin-bottom: 26px; }
.login-form__head h2 { font-size: 24px; font-weight: 700; letter-spacing: -.3px; }
.login-form__head p { color: var(--c-text-3); font-size: 13px; margin-top: 6px; }

.login-form .field { margin-bottom: 16px; }
.login-form__row { display: flex; gap: 10px; }
.login-captcha {
  flex: 0 0 118px; height: 42px; border-radius: var(--r-sm);
  border: 1px solid var(--c-border-strong);
  background: linear-gradient(115deg, #eef4ff, #e6ecff 40%, #f5f0ff);
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 20px; font-weight: 700;
  letter-spacing: 5px; color: #1e3a8a; user-select: none; cursor: pointer;
  font-style: italic;
}
.login-form .btn-block { width: 100%; height: 44px; font-size: 15px; margin-top: 6px; }

.login-hint {
  margin-top: 20px; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--c-primary-50); border: 1px solid #dbeafe;
  font-size: 12.5px; color: #1e40af; line-height: 1.9;
}
.login-hint code {
  background: #fff; padding: 1px 6px; border-radius: 4px;
  border: 1px solid #dbeafe; font-size: 12px;
}

@media (max-width: 980px) {
  .login-page { grid-template-columns: 1fr; }
  .login-brand { display: none; }
}

/* ---------- 应用外壳 ---------- */
.shell { display: flex; height: 100vh; overflow: hidden; }

/* 侧边栏 */
.sidebar {
  width: var(--w-sidebar);
  flex: 0 0 var(--w-sidebar);
  background: var(--grad-sidebar);
  position: relative;
  display: flex;
  flex-direction: column;
  transition: width var(--transition), flex-basis var(--transition);
  position: relative;
  z-index: 30;
}
.shell.is-collapsed .sidebar { width: var(--w-sidebar-collapsed); flex-basis: var(--w-sidebar-collapsed); }

.sidebar__brand {
  height: var(--h-topbar);
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  overflow: hidden;
}
.sidebar__mark {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 8px;
  background: linear-gradient(135deg, #3b82f6, #7c3aed);
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 13px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, .4);
}
.sidebar__name { color: #fff; font-weight: 600; font-size: 14.5px; letter-spacing: .2px; white-space: nowrap; }
.sidebar__ver { font-size: 10px; color: #63799b; letter-spacing: .6px; white-space: nowrap; }
.shell.is-collapsed .sidebar__name,
.shell.is-collapsed .sidebar__ver,
.shell.is-collapsed .sidebar__group-label,
.shell.is-collapsed .nav-item__text,
.shell.is-collapsed .nav-item__arrow,
.shell.is-collapsed .sidebar__foot-text { display: none; }

.sidebar__scroll { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: 8px 0 20px; }
.sidebar__scroll::-webkit-scrollbar { width: 5px; }
.sidebar__scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border: none; }

.sidebar__group-label {
  padding: 14px 18px 6px;
  font-size: 11px;
  color: #5b7093;
  letter-spacing: 1.4px;
  font-weight: 600;
  white-space: nowrap;
}

.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  margin: 1px 10px;
  padding: 0 10px;
  height: 38px;
  border-radius: var(--r-sm);
  color: var(--c-nav-text);
  cursor: pointer;
  user-select: none;
  transition: background var(--transition), color var(--transition);
  position: relative;
  white-space: nowrap;
}
.nav-item:hover { background: var(--c-nav-hover); color: #fff; text-decoration: none; }
.nav-item.is-active {
  background: linear-gradient(90deg, rgba(34, 211, 238, .22) 0%, rgba(34, 211, 238, .06) 100%);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, .22);
}
.nav-item.is-active::before {
  content: "";
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0;
  background: var(--c-nav-active);
  box-shadow: 0 0 10px 1px rgba(34, 211, 238, .85);
}
.nav-item.is-active .nav-item__icon { opacity: 1; color: var(--c-nav-active); }
.nav-item.is-open { color: #fff; }
.nav-item__icon { width: 18px; flex: 0 0 18px; display: grid; place-items: center; opacity: .92; }
.nav-item__icon svg { width: 17px; height: 17px; }
.nav-item__text { flex: 1 1 auto; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; }
.nav-item__arrow { font-size: 10px; opacity: .6; transition: transform var(--transition); }
.nav-item.is-open .nav-item__arrow { transform: rotate(90deg); }
.nav-item__badge {
  font-size: 10.5px; background: var(--c-danger); color: #fff;
  border-radius: var(--r-full); padding: 0 6px; height: 17px; line-height: 17px; font-weight: 600;
}

.nav-sub { overflow: hidden; }
.nav-sub .nav-item {
  height: 34px;
  margin: 1px 10px 1px 18px;
  padding-left: 26px;
  font-size: 13px;
}
.nav-sub .nav-item::before {
  content: ""; position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .45;
}
.nav-sub .nav-item.is-active::before { opacity: 1; }
.shell.is-collapsed .nav-sub { display: none; }

.sidebar__foot {
  flex-shrink: 0;
  padding: 10px 14px;
  border-top: 1px solid rgba(255, 255, 255, .06);
  display: flex; align-items: center; gap: 10px;
  color: #6b7f9e; font-size: 11.5px;
  cursor: pointer;
}
.sidebar__foot:hover { color: #a9b7cc; }
.sidebar__foot-text { white-space: nowrap; }

/* 主区域 */
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  height: var(--h-topbar);
  flex-shrink: 0;
  background: var(--c-surface-glass);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(203, 213, 225, .7);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, var(--sh-1);
  display: flex; align-items: center; gap: 12px;
  padding: 0 18px;
  z-index: 20;
}
.topbar__toggle {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  display: grid; place-items: center; color: var(--c-text-2);
}
.topbar__toggle:hover { background: var(--c-neutral-bg); }

.breadcrumb { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--c-text-3); }
.breadcrumb__sep { color: #cbd5e1; font-size: 11px; }
.breadcrumb__cur { color: var(--c-text); font-weight: 600; }

.topbar__spacer { flex: 1 1 auto; }

.topbar__search {
  position: relative;
  width: 260px;
}
.topbar__search input {
  width: 100%; height: 34px; padding: 0 12px 0 32px;
  border-radius: var(--r-full); border: 1px solid var(--c-border);
  background: var(--c-surface-2); font-size: 13px; outline: none;
  transition: border-color var(--transition), background var(--transition);
}
.topbar__search input:focus { border-color: var(--c-primary-500); background: #fff; }
.topbar__search::before {
  content: ""; position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 13px; height: 13px; opacity: .5;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 2a8 8 0 105.29 14.13l4.29 4.29 1.42-1.42-4.29-4.29A8 8 0 0010 2zm0 2a6 6 0 110 12 6 6 0 010-12z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 2a8 8 0 105.29 14.13l4.29 4.29 1.42-1.42-4.29-4.29A8 8 0 0010 2zm0 2a6 6 0 110 12 6 6 0 010-12z'/%3E%3C/svg%3E") center/contain no-repeat;
  color: var(--c-text-3);
}
.topbar__search-pop {
  position: absolute; top: 40px; left: 0; right: 0;
  background: #fff; border: 1px solid var(--c-border);
  border-radius: var(--r-md); box-shadow: var(--sh-4);
  max-height: 340px; overflow-y: auto; padding: 6px; z-index: 60;
  display: none;
}
.topbar__search.is-open .topbar__search-pop { display: block; animation: rise-in 140ms ease; }
.search-hit {
  padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer;
  display: flex; align-items: center; gap: 10px;
}
.search-hit:hover { background: var(--c-primary-50); }
.search-hit__mod { font-size: 11px; color: var(--c-text-3); flex-shrink: 0; }

.icon-btn {
  position: relative;
  width: 34px; height: 34px; border-radius: var(--r-sm);
  display: grid; place-items: center; color: var(--c-text-2);
  transition: background var(--transition);
}
.icon-btn:hover { background: var(--c-neutral-bg); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn__dot {
  position: absolute; top: 5px; right: 5px;
  min-width: 15px; height: 15px; padding: 0 4px;
  background: var(--c-danger); color: #fff;
  border-radius: var(--r-full); font-size: 10px; line-height: 15px;
  text-align: center; font-weight: 600; border: 2px solid #fff;
  box-sizing: content-box;
}

.topbar__org {
  display: flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 10px; border-radius: var(--r-sm);
  border: 1px solid var(--c-border); background: var(--c-surface-2);
  font-size: 12.5px; color: var(--c-text-2); cursor: pointer;
}
.topbar__org:hover { border-color: var(--c-border-strong); }

.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px; border-radius: var(--r-full);
  cursor: pointer; transition: background var(--transition);
}
.user-chip:hover { background: var(--c-neutral-bg); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  color: #fff; font-size: 12px; font-weight: 600;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  letter-spacing: -.3px;
}
.user-chip__name { font-size: 13px; font-weight: 600; line-height: 1.25; }
.user-chip__role { font-size: 11px; color: var(--c-text-3); line-height: 1.25; }

/* 页签栏 */
.tabbar {
  height: 40px; flex-shrink: 0;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; gap: 2px;
  padding: 0 12px; overflow-x: auto; overflow-y: hidden;
}
.tabbar::-webkit-scrollbar { height: 0; }
.tab {
  display: flex; align-items: center; gap: 7px;
  height: 28px; padding: 0 10px 0 12px;
  border-radius: var(--r-sm);
  font-size: 12.5px; color: var(--c-text-2);
  white-space: nowrap; cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition), color var(--transition);
}
.tab:hover { background: var(--c-neutral-bg); }
.tab.is-active {
  background: var(--c-primary-50); color: var(--c-primary-700);
  border-color: #c7dbff; font-weight: 600;
}
.tab__close {
  width: 15px; height: 15px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; line-height: 1;
  color: inherit; opacity: .5;
}
.tab__close:hover { background: rgba(0, 0, 0, .1); opacity: 1; }
.tab--home { padding-left: 10px; }

/* 内容区 */
.content {
  flex: 1 1 auto; overflow-y: auto; overflow-x: hidden;
  padding: 20px 22px 44px;
  background: var(--c-bg);
  background-image: var(--c-bg-grad);
  background-attachment: fixed;
  scroll-behavior: smooth;
}
.content__inner { animation: rise-in 200ms ease; max-width: 100%; }

/* 品牌侧边栏顶部光带 */
.sidebar::after {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 160px;
  background: radial-gradient(420px 120px at 18% 0%, rgba(34, 211, 238, .20), transparent 70%);
  pointer-events: none;
}
.sidebar > * { position: relative; z-index: 1; }

@media (max-width: 900px) {
  .topbar__search { display: none; }
  .user-chip__name, .user-chip__role { display: none; }
}

/* ==========================================================================
   移动端适配
   ========================================================================== */
.shell__overlay { display: none; }

@media (max-width: 900px) {
  /* 侧栏改为覆盖式抽屉 */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 264px; flex: 0 0 264px;
    transform: translateX(-100%);
    transition: transform .24s ease;
    z-index: 80;
    box-shadow: 0 0 40px rgba(0, 0, 0, .38);
  }
  .shell.is-nav-open .sidebar { transform: translateX(0); }
  /* 移动端忽略桌面折叠态，保持完整菜单宽度与文字 */
  .shell.is-collapsed .sidebar { width: 264px; flex-basis: 264px; }
  .shell.is-collapsed .sidebar__name,
  .shell.is-collapsed .sidebar__ver,
  .shell.is-collapsed .sidebar__group-label,
  .shell.is-collapsed .nav-item__text,
  .shell.is-collapsed .nav-item__arrow { display: block; }
  .shell.is-collapsed .nav-sub { display: block; }

  .shell__overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(15, 23, 42, .45); z-index: 70;
  }
  .shell.is-nav-open .shell__overlay { display: block; }

  .topbar { padding: 0 12px; gap: 8px; }
  .tabbar { padding: 0 8px; }
  .content { padding: 14px 12px 34px; }
  .page-head__title { font-size: 17px; }
}

@media (max-width: 640px) {
  .topbar__org { display: none; }
  .breadcrumb { display: none; }
  .kpi__value { font-size: 22px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-head__actions { width: 100%; }
}

/* 页面内联自定义栅格在手机上统一单列（覆盖行内 style） */
@media (max-width: 780px) {
  .grid[style] { grid-template-columns: 1fr !important; }
  .toolbar { gap: 6px; }
  .toolbar .input, .toolbar .select { min-width: 0 !important; }
}
