:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --border: #e5e9f0;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-d: #1d4ed8;
  --sidebar: #0f172a;
  --sidebar-2: #1e293b;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #2563eb;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 8px 24px rgba(15,23,42,.06);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--text); }

/* ===== 登录页 ===== */
.auth-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #0ea5e9 100%);
}
.auth-card {
  width: 360px; max-width: 92vw; background: var(--panel);
  border-radius: 16px; padding: 36px 30px; box-shadow: var(--shadow); text-align: center;
}
.auth-logo { font-size: 42px; }
.auth-card h1 { font-size: 20px; margin: 10px 0 4px; }
.auth-sub { color: var(--muted); font-size: 13px; margin: 0 0 22px; }
.auth-card label { display: block; text-align: left; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.auth-card input {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 9px;
  font-size: 14px; outline: none; transition: border-color .15s;
}
.auth-card input:focus { border-color: var(--primary); }
.btn-primary {
  width: 100%; margin-top: 20px; padding: 12px; border: none; border-radius: 9px;
  background: var(--primary); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.btn-primary:hover { background: var(--primary-d); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.msg { margin-top: 14px; min-height: 18px; font-size: 13px; color: #dc2626; }
.auth-foot { margin-top: 18px; font-size: 12px; color: var(--muted); }

/* ===== 门户壳 ===== */
.portal-body { display: flex; height: 100vh; overflow: hidden; background: var(--bg); }
.sidebar {
  width: 232px; flex: 0 0 232px; background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; padding: 18px 14px; overflow: hidden;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; flex: 0 0 auto; }
.brand-logo { font-size: 22px; }
.brand-name { font-size: 16px; font-weight: 700; color: #fff; letter-spacing: .5px; }
/* 导航区独立滚动：菜单全展开（出海 + 湄南河）时不再撑破侧栏背景 */
.nav {
  display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto;
  min-height: 0; overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin; scrollbar-color: rgba(148,163,184,.35) transparent;
}
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-track { background: transparent; }
.nav::-webkit-scrollbar-thumb { background: rgba(148,163,184,.32); border-radius: 3px; }
.nav::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,.5); }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 10px;
  color: var(--sidebar-text); text-decoration: none; cursor: pointer; transition: background .15s;
  flex: 0 0 auto;
}
.nav-item:hover { background: var(--sidebar-2); }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-icon { font-size: 18px; }
.nav-text { display: flex; flex-direction: column; line-height: 1.25; }
.nav-text b { font-size: 14px; font-weight: 600; }
.nav-text small { font-size: 11px; opacity: .7; }
.sidebar-foot { flex: 0 0 auto; font-size: 11px; opacity: .5; padding: 10px 8px 0; }

/* ===== 树形导航（出海子系统菜单收进左侧） ===== */
.nav-group-head { position: relative; }
.nav-group-head .caret {
  margin-left: auto; font-size: 10px; opacity: .55; transition: transform .15s ease; transform: rotate(0deg);
}
.nav-group-head.open .caret { transform: rotate(90deg); }
.nav-children {
  display: none; flex-direction: column; gap: 2px; flex: 0 0 auto;
  margin: 2px 0 6px 20px; padding-left: 10px; border-left: 1px solid var(--sidebar-2);
}
.nav-children.open { display: flex; }
.nav-child {
  display: block; padding: 8px 12px; border-radius: 8px; color: var(--sidebar-text);
  text-decoration: none; font-size: 13px; cursor: pointer; transition: background .15s;
  flex: 0 0 auto;
}
.nav-child:hover { background: var(--sidebar-2); }
.nav-child.active { background: var(--sidebar-active); color: #fff; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px; flex: 0 0 56px; background: var(--panel); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
}
.crumb { font-size: 15px; font-weight: 600; }
.userbox { display: flex; align-items: center; gap: 12px; }
.uname { font-size: 13px; color: var(--muted); }
.btn-ghost {
  border: 1px solid var(--border); background: #fff; color: var(--text); padding: 6px 14px;
  border-radius: 8px; font-size: 13px; cursor: pointer; transition: background .15s, border-color .15s;
}
.btn-ghost:hover { background: #f1f5f9; border-color: #cbd5e1; }
.stage { flex: 1; min-height: 0; background: var(--bg); }
#frame { width: 100%; height: 100%; border: 0; background: #fff; display: block; }

/* ===== 移动端 H5：汉堡按钮 + 抽屉遮罩 ===== */
.menu-btn {
  display: none; align-items: center; justify-content: center;
  width: 38px; height: 38px; margin-right: 4px; flex: 0 0 38px;
  border: none; background: transparent; color: var(--text);
  font-size: 20px; line-height: 1; cursor: pointer; border-radius: 8px;
}
.menu-btn:hover { background: #f1f5f9; }
.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 999;
  background: rgba(15, 23, 42, .45); opacity: 0; transition: opacity .2s;
}
body.sidebar-open .sidebar-overlay { display: block; opacity: 1; }

@media (max-width: 768px) {
  .portal-body { display: block; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 1000;
    width: 82%; max-width: 300px; transform: translateX(-100%);
    transition: transform .25s ease; box-shadow: var(--shadow);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .main { display: flex; flex-direction: column; height: 100vh; }
  .topbar { padding: 0 12px; }
  .menu-btn { display: flex; }
  .topbar .crumb { font-size: 14px; }
  .topbar .uname { display: none; }
  .topbar .userbox { gap: 8px; }
}

@media (max-width: 480px) {
  .brand-name { font-size: 15px; }
  .topbar .userbox .btn-ghost { padding: 6px 10px; }
}
