/* 3D配载 shell — aligned to 归类通 (hs.akone.cn) */
:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #1e86fc;
  --brand-dark: #1565c0;
  --brand-soft: #e8f3ff;
  --danger: #dc2626;
  --ok: #059669;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
  --font: "Microsoft YaHei", "微软雅黑", "PingFang SC", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --footer-height: 2.75rem;
  --side-nav-width: 11.25rem;
  --main-max: 1280px;
  --main-pad-x: 1.25rem;
  --cluster-max: calc(var(--side-nav-width) + var(--main-max));
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--footer-height);
}

a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0.75rem 0;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: nowrap;
  position: relative;
  min-height: calc(42px + 1.5rem);
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 0;
  position: relative;
  z-index: 2;
}
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 42px;
  height: 42px;
  border-radius: 0;
  object-fit: contain;
  background: transparent;
  display: block;
  flex-shrink: 0;
}
.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  gap: 0.1rem;
}
.logo-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
  letter-spacing: 0.01em;
}
.logo-sub {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.header-cluster {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, var(--cluster-max));
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-left: 0;
  padding-right: var(--main-pad-x);
  min-width: 0;
  z-index: 1;
}
.product-nav {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.25rem;
  flex: 0 1 auto;
  min-width: 0;
  flex-wrap: nowrap;
}
.product-nav button,
.product-nav a.nav-link {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  text-decoration: none;
  line-height: inherit;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;
}
.product-nav button:hover,
.product-nav a.nav-link:hover {
  background: var(--bg);
  color: var(--ink);
  text-decoration: none;
}
.product-nav button.active {
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.header-end {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
  flex-shrink: 0;
}
.header-auth { display: flex; align-items: center; gap: 0.5rem; }

.app-body {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  overflow: hidden;
  width: 100%;
}
.side-nav-backdrop { display: none; }
.side-nav {
  flex-shrink: 0;
  width: var(--side-nav-width);
  overflow: auto;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 0.75rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.side-nav button {
  width: 100%;
  text-align: right;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
}
.side-nav button:hover { background: var(--bg); color: var(--ink); }
.side-nav button.active {
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.main {
  flex: 0 1 var(--main-max);
  min-width: 0;
  min-height: 0;
  overflow: auto;
  width: 100%;
  max-width: var(--main-max);
  margin: 0;
  padding: 0.75rem var(--main-pad-x) 1.25rem 0.625rem;
}

/* Hide original packing header/footer; let shell own chrome */
#root > div > header { display: none !important; }
#root footer { display: none !important; }
#root a[href*="hyphenom.com"] { display: none !important; }
#root > div.min-h-svh,
#root > div[class*="min-h-svh"] {
  min-height: 0 !important;
  background: transparent !important;
}
#root > div > main {
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
}
#root[hidden] { display: none !important; }

.btn {
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 0.28rem 0.7rem;
  font-weight: 500;
  font-size: 0.82rem;
  line-height: 1.3;
  height: 28px;
  min-height: 28px;
  max-height: 28px;
  cursor: pointer;
  transition: .15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  white-space: nowrap;
  background: var(--surface);
  color: var(--ink);
  box-sizing: border-box;
  flex: 0 0 auto;
  align-self: center;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn.primary:hover:not(:disabled) {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}
.btn.ghost,
.btn.outline {
  background: #fff;
  border-color: var(--brand);
  color: var(--brand);
}
.btn.ghost:hover:not(:disabled),
.btn.outline:hover:not(:disabled) {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-dark);
}
.btn.sm {
  padding: 0.28rem 0.7rem;
  font-size: 0.82rem;
  border-radius: 4px;
  height: 28px;
}

.user-menu { position: relative; }
.user-menu-btn {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.user-menu-btn:hover,
.user-menu-btn[aria-expanded="true"] {
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.user-menu-btn img {
  width: 32px;
  height: 32px;
  display: block;
  border-radius: 50%;
}
.user-menu-drop {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  min-width: 8.5rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  padding: 0.3rem;
  z-index: 40;
}
.user-menu-drop[hidden] { display: none !important; }
.user-menu-drop button {
  appearance: none;
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  color: var(--ink);
  font-weight: 500;
  cursor: pointer;
}
.user-menu-drop button:hover { background: var(--bg); color: var(--ink); }

.card.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.15rem 1.25rem;
}
.panel-head { margin-bottom: 0.75rem; }
.panel-head h2 { margin: 0; font-size: 1.1rem; }
.panel-head .sub { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.88rem; }
.profile-form {
  max-width: 28rem;
  display: grid;
  gap: 0.9rem;
  margin-top: 0.5rem;
}
.profile-form .field { display: grid; gap: 0.35rem; font-weight: 500; }
.profile-form .field input {
  font-weight: 400;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.profile-form .field input[readonly] {
  background: var(--bg);
  color: var(--muted);
}
.profile-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.4rem; }
.login-err { color: var(--danger); font-size: 0.85rem; margin: 0.6rem 0 0; }
.login-err[hidden] { display: none !important; }
#profile-view[hidden] { display: none !important; }

.footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  text-align: center;
  padding: 0.65rem 1.25rem;
  min-height: var(--footer-height);
  box-sizing: border-box;
  color: var(--muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--line);
  background: #fff;
}
.footer strong { color: var(--ink); font-weight: 700; }
.footer-company {
  color: inherit;
  text-decoration: none;
  margin-left: 0.6rem;
  cursor: default;
  pointer-events: none;
}
/* Company name is plain text, not a link. */
.footer-company:hover { color: inherit; text-decoration: none; }

.nav-toggle {
  display: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 0.4rem 0.65rem;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--ink);
}

.toast {
  position: fixed;
  top: 1.15rem;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  background: #1e86fc;
  color: #fff;
  padding: 0.7rem 1.1rem;
  border-radius: 10px;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: .25s;
  z-index: 100;
  max-width: 90vw;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.heyu-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 80;
}
.heyu-modal-backdrop[hidden],
.heyu-modal[hidden] { display: none !important; }
.heyu-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(26rem, calc(100vw - 2rem));
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 81;
  padding: 1.1rem 1.2rem 1.2rem;
}
.heyu-modal h3 { margin: 0 0 0.85rem; font-size: 1.05rem; }
.heyu-modal .field { display: grid; gap: 0.3rem; font-weight: 500; margin-bottom: 0.7rem; }
.heyu-modal .field input {
  font-weight: 400;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.heyu-modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.6rem; }

/* Hide default SSO chip; shell owns the auth control */
#heyu-sso-slot,
.heyu-sso-slot { display: none !important; }

@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; align-items: center; flex-shrink: 0; }
  .header-inner { gap: 0.55rem; padding: 0.65rem 0.85rem; }
  .logo-sub { display: none; }
  .header-cluster {
    position: static;
    transform: none;
    left: auto;
    width: auto;
    flex: 1;
    max-width: none;
    padding-left: 0;
    padding-right: 0;
    min-width: 0;
  }
  .product-nav { flex: 1; min-width: 0; justify-content: center; }
  .header-end { margin-left: auto; }
  .app-body { justify-content: flex-start; }
  .main {
    flex: 1 1 auto;
    max-width: none;
    width: 100%;
    margin: 0;
  }
  .side-nav {
    position: fixed;
    top: 0;
    left: 0;
    bottom: var(--footer-height);
    z-index: 35;
    width: 12rem;
    box-shadow: var(--shadow);
    transform: translateX(0);
    transition: transform .2s ease;
    padding-top: 4.75rem;
  }
  body.nav-collapsed .side-nav {
    transform: translateX(-110%);
    pointer-events: none;
    box-shadow: none;
  }
  .side-nav-backdrop {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: var(--footer-height);
    background: rgba(15, 23, 42, 0.35);
    z-index: 34;
    border: none;
    padding: 0;
    cursor: pointer;
  }
  body.nav-collapsed .side-nav-backdrop { display: none; }
}

.auth-hint { color: var(--muted); font-size: 0.82rem; margin: 0 0 0.4rem; }
.auth-code-row { display: flex; gap: 0.45rem; align-items: stretch; }
.auth-code-row input { flex: 1; min-width: 0; }
.auth-get-code {
  border: 1px solid var(--brand);
  background: #fff;
  color: var(--brand);
  border-radius: 8px;
  padding: 0 0.7rem;
  white-space: nowrap;
  cursor: pointer;
  font-weight: 500;
}
.auth-get-code:hover:not(:disabled) { background: var(--brand-soft); }
.auth-get-code:disabled { opacity: .55; cursor: not-allowed; }
.heyu-modal .close-btn {
  position: absolute;
  top: 0.65rem;
  right: 0.7rem;
  border: none;
  background: transparent;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0.15rem 0.3rem;
}
.heyu-modal { position: fixed; }
.heyu-modal .modal-head { position: relative; padding-right: 1.8rem; }

/* 货物表工具栏：对齐归类通「智能归类」右上角 新增/导入 按钮 */
#root section:has(h2 + span) > div.flex .ml-auto {
  gap: 0.5rem;
}
#root section:has(h2 + span) > div.flex .ml-auto > button {
  border: 1px solid var(--brand) !important;
  background: #fff !important;
  color: var(--brand) !important;
  border-radius: 4px !important;
  padding: 0.28rem 0.7rem !important;
  font-weight: 500 !important;
  font-size: 0.82rem !important;
  line-height: 1.3 !important;
  height: 28px !important;
  min-height: 28px !important;
  max-height: 28px !important;
  box-shadow: none !important;
}
#root section:has(h2 + span) > div.flex .ml-auto > button:hover {
  background: var(--brand-soft) !important;
  color: var(--brand-dark) !important;
}
#root section:has(h2 + span) > div.flex .ml-auto > button:first-child {
  background: var(--brand) !important;
  border-color: var(--brand) !important;
  color: #fff !important;
}
#root section:has(h2 + span) > div.flex .ml-auto > button:first-child:hover {
  background: var(--brand-dark) !important;
  border-color: var(--brand-dark) !important;
  color: #fff !important;
}

/* 货物标题后的「导入模板」下载链接 */
#root section:has(h2 + span) > div.flex > a.heyu-import-tpl {
  margin-left: 0.15rem;
  font-size: 0.82rem;
  line-height: 1.3;
  color: var(--brand);
  text-decoration: none;
  white-space: nowrap;
}
#root section:has(h2 + span) > div.flex > a.heyu-import-tpl:hover {
  color: var(--brand-dark);
  text-decoration: underline;
}
