:root{
  /* Design Tokens (Commercial Skin) */
  /* 外部留白背景：纯白（避免淡蓝色大面积铺底） */
  --wms-bg: #ffffff;
  --wms-surface: #ffffff;
  --wms-text: #0f172a;
  --wms-muted: #64748b;
  --wms-border: #e5e7eb;

  --wms-primary: #2563eb;
  --wms-primary-600: #1d4ed8;
  --wms-primary-50: #eff6ff;
  --wms-success-50: #ecfdf5;
  --wms-success: #16a34a;
  --wms-warn-50: #fffbeb;
  --wms-warn: #d97706;
  --wms-danger-50: #fff1f2;
  --wms-danger: #e11d48;

  /* Radius (keep minimal, closer to enterprise UI) */
  /* 圆角最小化（更“企业系统”） */
  --wms-radius-sm: 2px;
  --wms-radius-md: 3px;
  --wms-radius-lg: 4px;

  /* Shadows */
  --wms-shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --wms-shadow-md: 0 6px 16px rgba(15, 23, 42, .08);
  --wms-shadow-lg: 0 14px 36px rgba(15, 23, 42, .12);
}

html, body{
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--wms-text);
  background: var(--wms-bg);
}

/* Override Tailwind utility radii to keep style consistent site-wide */
.rounded{ border-radius: var(--wms-radius-sm) !important; }
.rounded-sm{ border-radius: var(--wms-radius-sm) !important; }
.rounded-md{ border-radius: var(--wms-radius-md) !important; }
.rounded-lg{ border-radius: var(--wms-radius-lg) !important; }
.rounded-xl{ border-radius: var(--wms-radius-lg) !important; }
.rounded-2xl{ border-radius: var(--wms-radius-lg) !important; }
.rounded-full{ border-radius: 9999px !important; }

/* Softer shadows */
.shadow-sm{ box-shadow: var(--wms-shadow-sm) !important; }
.shadow, .shadow-md{ box-shadow: var(--wms-shadow-md) !important; }
.shadow-lg, .shadow-xl{ box-shadow: var(--wms-shadow-lg) !important; }

/* Buttons (works with existing Tailwind classes, adds consistent focus/hover feel) */
button, a[role="button"], .wms-btn{
  outline: none;
}
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible{
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .18) !important;
}

/* Primary color hint for common Tailwind bg */
.bg-slate-900{ background-color: var(--wms-primary) !important; }
.hover\:bg-slate-900:hover{ background-color: var(--wms-primary-600) !important; }

/* Table polish */
table{ border-color: var(--wms-border); }
thead{ color: #334155; }
tbody tr:hover{ background: #f8fafc; }

/* Status badges */
.wms-badge{
  display:inline-flex;
  align-items:center;
  padding:2px 10px;
  border-radius:9999px;
  font-size:12px;
  font-weight:600;
  border:1px solid transparent;
  line-height:1.6;
}
.wms-badge-muted{ background:#f1f5f9; color:#475569; border-color:#e2e8f0; }
.wms-badge-warn{ background:var(--wms-warn-50); color:var(--wms-warn); border-color:rgba(217,119,6,.25); }
.wms-badge-success{ background:var(--wms-success-50); color:var(--wms-success); border-color:rgba(22,163,74,.25); }
.wms-badge-danger{ background:var(--wms-danger-50); color:var(--wms-danger); border-color:rgba(225,29,72,.25); }

/* Sidebar: commercial icon nav */
.wms-nav-item{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-radius: var(--wms-radius-md);
  color: #334155;
  text-decoration:none;
  font-weight:600;
  line-height:1;
}
.wms-nav-item:hover{ background:#f1f5f9; }
.wms-nav-item.is-active{
  background: var(--wms-primary-50);
  color: var(--wms-primary-600);
  border: 1px solid rgba(59,130,246,.25);
  box-shadow: none;
}
.wms-nav-ico{
  width:18px;
  height:18px;
  display:inline-flex;
}
.wms-nav-ico svg{ width:18px; height:18px; }

.wms-nav-group{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:10px 12px;
  border-radius: var(--wms-radius-md);
  color:#0f172a;
  font-weight:600;
  background: transparent;
  cursor:pointer;
}
.wms-nav-group:hover{ background:#f1f5f9; }

/* Sub menu items */
.wms-sub{
  margin-left: 30px;
  padding-left: 10px;
  border-left: 1px solid #e2e8f0;
}
.wms-sub a{
  font-weight:500;
  font-size: 13px;
  padding:9px 10px;
}

/* Sidebar links: keep neutral (avoid browser default visited purple). */
.wms-sidebar a:link,
.wms-sidebar a:visited{
  color: inherit;
  text-decoration: none;
}
.wms-sidebar .wms-sub-item:link,
.wms-sidebar .wms-sub-item:visited{
  color:#475569 !important;
}
.wms-sidebar .wms-sub-item.is-active:link,
.wms-sidebar .wms-sub-item.is-active:visited{
  color: var(--wms-primary-600) !important;
}
.wms-sidebar .link-doc{
  /* Never color menu links as "doc links" */
  color: inherit !important;
  font-weight: inherit !important;
}

/* Sidebar collapse (icon-only) */
.wms-sidebar.is-collapsed{ width: 84px !important; }
.wms-sidebar.is-collapsed .wms-brand-text{ display:none !important; }
.wms-sidebar.is-collapsed .wms-nav-item span,
.wms-sidebar.is-collapsed .wms-nav-group span.label,
.wms-sidebar.is-collapsed .wms-nav-group .chev,
.wms-sidebar.is-collapsed .wms-sub{
  display:none !important;
}
.wms-sidebar.is-collapsed .wms-nav-item{ justify-content:center; }
.wms-sidebar.is-collapsed .wms-nav-group{ justify-content:center; }

.wms-nav-section{ margin-top:8px; }
.wms-nav-sub{
  margin-left: 8px;
  padding-left: 10px;
  border-left: 2px solid #e2e8f0;
}
.wms-sub-item{
  display:flex;
  align-items:center;
  gap:10px;
  padding:9px 12px;
  border-radius: var(--wms-radius-sm);
  color:#475569;
  text-decoration:none;
  font-weight:500;
}
.wms-sub-item:hover{ background:#eef2ff; color:#1e293b; }
.wms-sub-item.is-active{
  background: var(--wms-primary-50);
  color: var(--wms-primary);
  font-weight:700;
}

/* Compact header button (hamburger) */
.wms-icon-btn{
  width:38px;
  height:38px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius: var(--wms-radius-md);
  border: 1px solid var(--wms-border);
  background: var(--wms-surface);
  color: #0f172a;
}
.wms-icon-btn:hover{ background:#f8fafc; }

.wms-nav-sub{
  margin-left: 30px;
  padding-left: 10px;
  border-left: 2px solid #e2e8f0;
}
.wms-sub-item{
  display:flex;
  align-items:center;
  padding:9px 10px;
  border-radius: var(--wms-radius-md);
  color:#475569;
  text-decoration:none;
  font-size: 13px;
  font-weight: 500;
}
.wms-sub-item:hover{ background:#f1f5f9; color:#0f172a; }
.wms-sub-item.is-active{ background: var(--wms-primary-50); color: var(--wms-primary-600); }

.wms-sidebar-shell{
  border-radius: 14px;
  box-shadow: var(--wms-shadow-sm);
}
.wms-sidebar-topbtn{
  width:40px;
  height:40px;
  border-radius: var(--wms-radius-md);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:#f1f5f9;
  color:#0f172a;
}
.wms-sidebar-topbtn:hover{ background:#e2e8f0; }

.wms-sidebar-collapsed .wms-nav-label{ display:none; }
.wms-sidebar-collapsed .wms-nav-group span.flex .wms-nav-label{ display:none; }
.wms-sidebar-collapsed .wms-nav-sub{ display:none; }
.wms-sidebar-collapsed{ width: 84px !important; padding: 12px !important; }
.wms-sidebar-collapsed .wms-brand-text{ display:none; }
.wms-sidebar-collapsed .wms-brand-meta{ display:none; }

/* Dialog backdrop consistency */
dialog::backdrop{ background: rgba(15, 23, 42, .55) !important; }

/* Doc links: make it obvious it's clickable (align with ledger/batches purple link) */
a[href^="/admin/docs/"]{
  color:#6d28d9;
  font-weight:600;
}
a[href^="/admin/docs/"]:hover{ text-decoration: underline; }
.link-doc{ color:#6d28d9 !important; font-weight:600; }

.wms-sidebar .wms-nav-item:visited{color:inherit !important;}
